CCM NG/ccm-cms: Test pass again
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4530 8810af33-2d31-482b-a856-94f89814c4dfccm-docs
parent
c899644e26
commit
08348b215e
|
|
@ -66,7 +66,7 @@ import static org.librecms.CmsConstants.*;
|
|||
@Entity
|
||||
@Audited
|
||||
@Table(name = "CONTENT_ITEMS", schema = DB_SCHEMA)
|
||||
@Indexed
|
||||
//@Indexed
|
||||
@NamedQueries({
|
||||
@NamedQuery(
|
||||
name = "ContentItem.findByType",
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
import org.libreccm.categorization.Category;
|
||||
import org.libreccm.security.Role;
|
||||
import org.libreccm.web.CcmApplication;
|
||||
|
||||
|
|
@ -41,6 +40,7 @@ import java.util.ArrayList;
|
|||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.OneToMany;
|
||||
|
||||
import org.libreccm.workflow.WorkflowTemplate;
|
||||
import org.librecms.lifecycle.LifecycleDefinition;
|
||||
|
||||
|
|
|
|||
|
|
@ -542,13 +542,13 @@ public class ContentSectionManager {
|
|||
|
||||
section.addContentType(contentType);
|
||||
|
||||
sectionRepo.save(section);
|
||||
typeRepo.save(contentType);
|
||||
|
||||
section.getRoles().stream()
|
||||
.forEach(role -> permissionManager.grantPrivilege(
|
||||
TypePrivileges.USE_TYPE, role, contentType));
|
||||
|
||||
sectionRepo.save(section);
|
||||
typeRepo.save(contentType);
|
||||
|
||||
return contentType;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@
|
|||
*/
|
||||
package org.librecms.contentsection;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
@ -119,6 +118,7 @@ public class AssetManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
@ -196,9 +196,11 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(100)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/after-share.xml",
|
||||
value
|
||||
= "datasets/org/librecms/contentsection/AssetManagerTest/after-share.xml",
|
||||
excludeColumns = {"asset_id",
|
||||
"categorization_id",
|
||||
"id",
|
||||
|
|
@ -232,8 +234,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(110)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void shareAssetNull() {
|
||||
final Folder folder = folderRepo.findById(-420L);
|
||||
|
|
@ -252,8 +256,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(120)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void shareAssetFolderIsNull() throws MimeTypeParseException {
|
||||
final File file = new File();
|
||||
|
|
@ -272,8 +278,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(130)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void shareAlreadySharedAsset() {
|
||||
final Folder folder = folderRepo.findById(-420L);
|
||||
|
|
@ -291,7 +299,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(300)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-clean-orphaned.xml",
|
||||
|
|
@ -307,7 +316,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(400)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-move-to-other-folder.xml",
|
||||
|
|
@ -332,7 +342,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(410)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-move-to-other-contentsection.xml",
|
||||
|
|
@ -358,8 +369,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(420)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void moveAssetNull() {
|
||||
final Asset asset = null;
|
||||
|
|
@ -378,8 +391,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(430)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void moveAssetTargetFolderIsNull() {
|
||||
final Asset asset = assetRepo.findById(-900L);
|
||||
|
|
@ -398,8 +413,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(430)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void moveAssetTargetFolderIsNotAssetFolder() {
|
||||
final Asset asset = assetRepo.findById(-900L);
|
||||
|
|
@ -417,7 +434,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(500)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-copy-to-other-folder.xml",
|
||||
|
|
@ -445,7 +463,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(510)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-copy-to-same-folder.xml",
|
||||
|
|
@ -475,7 +494,8 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(520)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/librecms/contentsection/AssetManagerTest/"
|
||||
+ "after-copy-to-other-contentsection.xml",
|
||||
|
|
@ -505,8 +525,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(530)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void copyAssetNull() {
|
||||
final Asset asset = null;
|
||||
|
|
@ -525,8 +547,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(540)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void copyAssetTargetFolderIsNull() {
|
||||
final Asset asset = assetRepo.findById(-1100L);
|
||||
|
|
@ -545,8 +569,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@InSequence(550)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void copyAssetTargetFolderIsNotAssetFolder() {
|
||||
final Asset asset = assetRepo.findById(-1100L);
|
||||
|
|
@ -565,8 +591,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(600)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
public void verifyIsAssetInUse() {
|
||||
final Asset header = assetRepo.findById(-700L);
|
||||
final Asset phb = assetRepo.findById(-800L);
|
||||
|
|
@ -594,8 +622,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(700)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
public void verifyGetAssetPathWithoutContentSection() {
|
||||
final Asset header = assetRepo.findById(-700L);
|
||||
final Asset phb = assetRepo.findById(-800L);
|
||||
|
|
@ -628,8 +658,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(800)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
public void verifyGetAssetPathWithContentSection() {
|
||||
final Asset header = assetRepo.findById(-700L);
|
||||
final Asset phb = assetRepo.findById(-800L);
|
||||
|
|
@ -662,8 +694,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(900)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
public void verifyGetAssetFolder() {
|
||||
final Asset header = assetRepo.findById(-700L);
|
||||
final Asset phb = assetRepo.findById(-800L);
|
||||
|
|
@ -715,8 +749,10 @@ public class AssetManagerTest {
|
|||
*/
|
||||
@Test
|
||||
@InSequence(1000)
|
||||
@UsingDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet("datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@UsingDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
"datasets/org/librecms/contentsection/AssetManagerTest/data.xml")
|
||||
public void verifyGetAssetFolders() {
|
||||
final Asset header = assetRepo.findById(-700L);
|
||||
final Asset phb = assetRepo.findById(-800L);
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public class AssetRepositoryTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ public class AttachmentListManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ 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 java.util.Locale;
|
||||
|
|
@ -70,6 +71,9 @@ public class ContentItemL10NManagerTest {
|
|||
@Inject
|
||||
private ContentItemL10NManager l10nManager;
|
||||
|
||||
@Inject
|
||||
private Shiro shiro;
|
||||
|
||||
public ContentItemL10NManagerTest() {
|
||||
}
|
||||
|
||||
|
|
@ -107,6 +111,7 @@ public class ContentItemL10NManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
@ -171,15 +176,18 @@ public class ContentItemL10NManagerTest {
|
|||
@UsingDataSet("datasets/org/librecms/contentsection/"
|
||||
+ "ContentItemL10NManagerTest/data.xml")
|
||||
public void verifyHasLanguage() {
|
||||
final Optional<ContentItem> item = itemRepo.findById(-10100L);
|
||||
assertThat(item.isPresent(), is(true));
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final Optional<ContentItem> item = itemRepo.findById(-10100L);
|
||||
assertThat(item.isPresent(), is(true));
|
||||
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.ENGLISH),
|
||||
is(true));
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.FRENCH),
|
||||
is(true));
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.GERMAN),
|
||||
is(false));
|
||||
});
|
||||
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.ENGLISH),
|
||||
is(true));
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.FRENCH),
|
||||
is(true));
|
||||
assertThat(l10nManager.hasLanguage(item.get(), Locale.GERMAN),
|
||||
is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -378,8 +386,8 @@ public class ContentItemL10NManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tries to normalise the languages of a content item by using null null
|
||||
* null null null null null null null null null null null {@link ContentItemL10NManager#normalizedLanguages(org.librecms.contentsection.ContentItem)
|
||||
* Tries to normalise the languages of a content item by using
|
||||
* {@link ContentItemL10NManager#normalizedLanguages(org.librecms.contentsection.ContentItem)}
|
||||
*/
|
||||
@Test
|
||||
@InSequence(120)
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ public class ContentItemManagerTest {
|
|||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
.addPackage(com.arsdigita.bebop.Component.class.getPackage())
|
||||
|
|
@ -229,28 +230,30 @@ public class ContentItemManagerTest {
|
|||
"workflow_id"
|
||||
})
|
||||
public void createContentItem() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
final Article article = itemManager.createContentItem("new-article",
|
||||
section,
|
||||
folder,
|
||||
Article.class);
|
||||
final Article article = itemManager.createContentItem("new-article",
|
||||
section,
|
||||
folder,
|
||||
Article.class);
|
||||
|
||||
assertThat("DisplayName has not the expected value.",
|
||||
article.getDisplayName(), is(equalTo("new-article")));
|
||||
final Locale locale = new Locale("en");
|
||||
assertThat("Name has not the expected value.",
|
||||
article.getName().getValue(locale),
|
||||
is(equalTo("new-article")));
|
||||
assertThat("workflow was not added to content item.",
|
||||
article.getWorkflow(), is(not(nullValue())));
|
||||
assertThat("DisplayName has not the expected value.",
|
||||
article.getDisplayName(), is(equalTo("new-article")));
|
||||
final Locale locale = new Locale("en");
|
||||
assertThat("Name has not the expected value.",
|
||||
article.getName().getValue(locale),
|
||||
is(equalTo("new-article")));
|
||||
assertThat("workflow was not added to content item.",
|
||||
article.getWorkflow(), is(not(nullValue())));
|
||||
|
||||
final TypedQuery<Long> query = entityManager.createQuery(
|
||||
"SELECT COUNT(w) FROM Workflow w", Long.class);
|
||||
final long workflowCount = query.getSingleResult();
|
||||
assertThat("Expected three workflows in database.",
|
||||
workflowCount, is(4L));
|
||||
final TypedQuery<Long> query = entityManager.createQuery(
|
||||
"SELECT COUNT(w) FROM Workflow w", Long.class);
|
||||
final long workflowCount = query.getSingleResult();
|
||||
assertThat("Expected three workflows in database.",
|
||||
workflowCount, is(4L));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -286,10 +289,12 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemNameIsNull() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
itemManager.createContentItem(null, section, folder, Article.class);
|
||||
itemManager.createContentItem(null, section, folder, Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -305,10 +310,12 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemNameIsEmpty() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
itemManager.createContentItem(" ", section, folder, Article.class);
|
||||
itemManager.createContentItem(" ", section, folder, Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -325,9 +332,11 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemFolderIsNull() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
|
||||
itemManager.createContentItem("Test", section, null, Article.class);
|
||||
itemManager.createContentItem("Test", section, null, Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -356,33 +365,35 @@ public class ContentItemManagerTest {
|
|||
"workflow_id"
|
||||
})
|
||||
public void createContentItemWithWorkflow() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
|
||||
final Article article = itemManager.createContentItem(
|
||||
"new-article",
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
final Article article = itemManager.createContentItem(
|
||||
"new-article",
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
|
||||
assertThat("DisplayName has not the expected value.",
|
||||
article.getDisplayName(), is(equalTo("new-article")));
|
||||
final Locale locale = new Locale("en");
|
||||
assertThat("Name has not the expected value.",
|
||||
article.getName().getValue(locale),
|
||||
is(equalTo("new-article")));
|
||||
assertThat("workflow was not added to content item.",
|
||||
article.getWorkflow(), is(not(nullValue())));
|
||||
assertThat("DisplayName has not the expected value.",
|
||||
article.getDisplayName(), is(equalTo("new-article")));
|
||||
final Locale locale = new Locale("en");
|
||||
assertThat("Name has not the expected value.",
|
||||
article.getName().getValue(locale),
|
||||
is(equalTo("new-article")));
|
||||
assertThat("workflow was not added to content item.",
|
||||
article.getWorkflow(), is(not(nullValue())));
|
||||
|
||||
final TypedQuery<Long> query = entityManager.createQuery(
|
||||
"SELECT COUNT(w) FROM Workflow w", Long.class);
|
||||
final long workflowCount = query.getSingleResult();
|
||||
assertThat("Expected three workflows in database.",
|
||||
workflowCount, is(4L));
|
||||
final TypedQuery<Long> query = entityManager.createQuery(
|
||||
"SELECT COUNT(w) FROM Workflow w", Long.class);
|
||||
final long workflowCount = query.getSingleResult();
|
||||
assertThat("Expected three workflows in database.",
|
||||
workflowCount, is(4L));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -399,17 +410,19 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemTypeNotInSectionWithWorkflow() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
|
||||
itemManager.createContentItem("Test",
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Event.class);
|
||||
itemManager.createContentItem("Test",
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Event.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -426,17 +439,19 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemNameIsNullWithWorkflow() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
|
||||
itemManager.createContentItem(null,
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
itemManager.createContentItem(null,
|
||||
section,
|
||||
folder,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -453,14 +468,16 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemNameIsNullWorkflowIsNull() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
final Folder folder = section.getRootDocumentsFolder();
|
||||
|
||||
itemManager.createContentItem(null,
|
||||
section,
|
||||
folder,
|
||||
null,
|
||||
Article.class);
|
||||
itemManager.createContentItem(null,
|
||||
section,
|
||||
folder,
|
||||
null,
|
||||
Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -477,16 +494,18 @@ public class ContentItemManagerTest {
|
|||
+ "ContentItemManagerTest/data.xml")
|
||||
@ShouldThrowException(IllegalArgumentException.class)
|
||||
public void createItemFolderIsNullWithWorkflow() {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
shiro.getSystemUser().execute(() -> {
|
||||
final ContentSection section = sectionRepo.findByLabel("info");
|
||||
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
final WorkflowTemplate workflowTemplate = workflowTemplateRepo
|
||||
.findById(-110L);
|
||||
|
||||
itemManager.createContentItem("Test",
|
||||
section,
|
||||
null,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
itemManager.createContentItem("Test",
|
||||
section,
|
||||
null,
|
||||
workflowTemplate,
|
||||
Article.class);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -550,7 +569,7 @@ public class ContentItemManagerTest {
|
|||
}
|
||||
|
||||
/**
|
||||
* Verifies that null {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)
|
||||
* Verifies that null null null null null null null null null null null null {@link ContentItemManager#move(org.librecms.contentsection.ContentItem, org.librecms.contentsection.Folder)
|
||||
* throws an {@link IllegalArgumentException} if the type of the item to
|
||||
* copy has not been registered in content section to which the target
|
||||
* folder belongs.
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public class ContentItemRepositoryTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ public class ContentSectionManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.portation.Portable.class.getPackage())
|
||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class.
|
||||
getPackage())
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
|
|
@ -425,7 +426,9 @@ public class ContentSectionManagerTest {
|
|||
value = "datasets/org/librecms/contentsection/"
|
||||
+ "ContentSectionManagerTest/after-add-contenttype.xml",
|
||||
excludeColumns = {"object_id",
|
||||
"uuid"})
|
||||
"uuid",
|
||||
"permission_id",
|
||||
"creation_date"})
|
||||
@InSequence(400)
|
||||
public void addContentTypeToSection() {
|
||||
final ContentSection section = repository.findById(-1100L);
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public class ContentTypeRepositoryTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public class FolderManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class.
|
||||
getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ public class ItemAttachmentManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.l10n.LocalizedString.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.security.Permission.class.getPackage())
|
||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||
|
|
|
|||
|
|
@ -529,5 +529,35 @@
|
|||
object_id="-1100"
|
||||
grantee_id="-3600"
|
||||
creation_date="2016-07-15"/>
|
||||
<ccm_core.permissions permission_id="-4710"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3100"
|
||||
creation_date="2016-07-15" />
|
||||
<ccm_core.permissions permission_id="-4720"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15" />
|
||||
<ccm_core.permissions permission_id="-4730"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15" />
|
||||
<ccm_core.permissions permission_id="-4740"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15" />
|
||||
<ccm_core.permissions permission_id="-4750"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15" />
|
||||
<ccm_core.permissions permission_id="-4760"
|
||||
granted_privilege="use_type"
|
||||
object_id="-10003"
|
||||
grantee_id="-3600"
|
||||
creation_date="2016-07-15" />
|
||||
|
||||
</dataset>
|
||||
|
|
|
|||
Loading…
Reference in New Issue