CCM NG/ccm-cms:

- Extended ContentSectionManager with bodies of methods for managing ContentTypes for a section, added bodies for tests to ContentSectionManager
- Some improvments for other tests in ccm-cms
- index page for project site of ccm-cms

CCM NG/ccm-shortcuts:
- Adjusted tests to lastest changes in ccm-core (DB-Schema)


git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4367 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-10-09 17:12:05 +00:00
parent 0cccf9dec4
commit dd4e669357
8 changed files with 453 additions and 70 deletions

View File

@ -500,6 +500,7 @@ public class ContentSectionManager {
* @throws IllegalArgumentException if the provided {@link ContentType} is * @throws IllegalArgumentException if the provided {@link ContentType} is
* in use or the parameters or otherwise * in use or the parameters or otherwise
* illegal. * illegal.
* @see ContentTypeRepository#delete(org.librecms.contentsection.ContentType)
*/ */
public void removeContentTypeFromSection( public void removeContentTypeFromSection(
final Class<? extends ContentItem> type, final Class<? extends ContentItem> type,

View File

@ -0,0 +1,12 @@
----------------
Overview
----------------
Jens Pelzetter
----------------
2016-10-09
----------------
LibreCMS
The <CMS> module (<<<ccm-cms>>>) for <LibreCCM> provides the foundation
for the CMS functionality of LibreCCM

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<project xmlns="http://maven.apache.org/DECORATION/1.3.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/DECORATION/1.3.0
http://maven.apache.org/xsd/decoration-1.3.0.xsd">
<body>
<menu name="Parent project">
<item name="LibreCCM" href="../index.html"/>
</menu>
<menu name="Overview">
<item name="The CMS module" href="index.html"/>
</menu>
<menu ref="reports"/>
</body>
<!--<skin>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-fluido-skin</artifactId>
<version>1.4</version>
</skin>-->
</project>

View File

@ -31,17 +31,12 @@ import org.jboss.arquillian.transaction.api.annotation.Transactional;
import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset; import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive; import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.jboss.shrinkwrap.resolver.api.maven.Maven;
import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
import org.jboss.shrinkwrap.resolver.api.maven.ScopeType;
import org.jboss.shrinkwrap.resolver.api.maven.coordinate.MavenDependencies;
import org.junit.After; import org.junit.After;
import org.junit.AfterClass; import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.libreccm.categorization.Category;
import org.libreccm.categorization.CategoryRepository; import org.libreccm.categorization.CategoryRepository;
import org.libreccm.security.Shiro; import org.libreccm.security.Shiro;
import org.libreccm.tests.categories.IntegrationTest; import org.libreccm.tests.categories.IntegrationTest;
@ -52,12 +47,8 @@ import org.librecms.contenttypes.Event;
import org.librecms.lifecycle.LifecycleDefinition; import org.librecms.lifecycle.LifecycleDefinition;
import org.librecms.lifecycle.LifecycleDefinitionRepository; import org.librecms.lifecycle.LifecycleDefinitionRepository;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Optional; import java.util.Optional;
import java.util.stream.IntStream;
import javax.inject.Inject; import javax.inject.Inject;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
@ -65,6 +56,7 @@ import javax.persistence.TypedQuery;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.libreccm.testutils.DependenciesHelpers.*; import static org.libreccm.testutils.DependenciesHelpers.*;
/** /**
@ -92,7 +84,7 @@ public class ContentItemManagerTest {
@Inject @Inject
private FolderRepository folderRepo; private FolderRepository folderRepo;
@Inject @Inject
private Shiro shiro; private Shiro shiro;
@ -126,37 +118,6 @@ public class ContentItemManagerTest {
@Deployment @Deployment
public static WebArchive createDeployment() { public static WebArchive createDeployment() {
//// final PomEquippedResolveStage pom = Maven
//// .resolver()
//// .loadPomFromFile("pom.xml");
//// final PomEquippedResolveStage dependencies = pom
//// .importCompileAndRuntimeDependencies();
//// dependencies.addDependency(MavenDependencies.createDependency(
//// "org.libreccm:ccm-core", ScopeType.RUNTIME, false));
//// dependencies.addDependency(MavenDependencies.createDependency(
//// "org.libreccm:ccm-testutils", ScopeType.RUNTIME, false));
//// dependencies.addDependency(MavenDependencies.createDependency(
//// "net.sf.saxon:Saxon-HE", ScopeType.RUNTIME, false));
//// dependencies.addDependency(MavenDependencies.createDependency(
//// "org.jboss.shrinkwrap.resolver:shrinkwrap-resolver-impl-maven",
//// ScopeType.RUNTIME, false));
//// final File[] libsWithCcmCore = dependencies.resolve().withTransitivity()
//// .asFile();
////
// final List<File> libsList = new ArrayList<>(libsWithCcmCore.length - 1);
// IntStream.range(0, libsWithCcmCore.length).forEach(i -> {
// final File lib = libsWithCcmCore[i];
// if (!lib.getName().startsWith("ccm-core")) {
// libsList.add(lib);
// }
// });
// final File[] libs = libsList.toArray(new File[libsList.size()]);
//
// for (File lib : libs) {
// System.err.printf("Adding file '%s' to test archive...%n",
// lib.getName());
// }
return ShrinkWrap return ShrinkWrap
.create(WebArchive.class, .create(WebArchive.class,
"LibreCCM-org.librecms.contentsection.ContentItemManagerTest.war") "LibreCCM-org.librecms.contentsection.ContentItemManagerTest.war")
@ -201,7 +162,9 @@ public class ContentItemManagerTest {
.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)
.addAsLibraries(getModuleDependencies()) .addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
// .addAsLibraries(getModuleDependencies())
.addAsLibraries(getCcmCoreDependencies()) .addAsLibraries(getCcmCoreDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini") .addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource( .addAsResource(

View File

@ -134,7 +134,9 @@ public class ContentItemRepositoryTest {
.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())
.addAsLibraries(getModuleDependencies()) .addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
// .addAsLibraries(getModuleDependencies())
.addAsLibraries(getCcmCoreDependencies()) .addAsLibraries(getCcmCoreDependencies())
.addAsResource("test-persistence.xml", .addAsResource("test-persistence.xml",
"META-INF/persistence.xml") "META-INF/persistence.xml")
@ -315,25 +317,25 @@ public class ContentItemRepositoryTest {
assertThat(itemRepo.countFilterByFolderAndName(folder, "foo"), assertThat(itemRepo.countFilterByFolderAndName(folder, "foo"),
is(0L)); is(0L));
} }
@Test @Test
@InSequence(600) @InSequence(600)
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/data.xml") + "ContentItemRepositoryTest/data.xml")
@ShouldMatchDataSet(value = "datasets/org/librecms/contentsection/" @ShouldMatchDataSet(value = "datasets/org/librecms/contentsection/"
+ "ContentItemRepositoryTest/after-save.xml", + "ContentItemRepositoryTest/after-save.xml",
excludeColumns = {"object_id", excludeColumns = {"object_id",
"uuid", "uuid",
"item_uuid", "item_uuid",
"timestamp"}) "timestamp"})
public void saveChangedItem() { public void saveChangedItem() {
final Optional<ContentItem> item = itemRepo.findById(-10100L); final Optional<ContentItem> item = itemRepo.findById(-10100L);
assertThat(item.isPresent(), is(true)); assertThat(item.isPresent(), is(true));
item.get().getName().addValue(Locale.ENGLISH, "first-article"); item.get().getName().addValue(Locale.ENGLISH, "first-article");
item.get().getTitle().addValue(Locale.ENGLISH, "First Article"); item.get().getTitle().addValue(Locale.ENGLISH, "First Article");
itemRepo.save(item.get()); itemRepo.save(item.get());
} }

View File

@ -52,9 +52,13 @@ import javax.inject.Inject;
import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import static org.librecms.CmsConstants.*; import static org.librecms.CmsConstants.*;
import static org.libreccm.testutils.DependenciesHelpers.*; import static org.libreccm.testutils.DependenciesHelpers.*;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
/** /**
* Tests for the {@link ContentSectionManager}.
* *
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a> * @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/ */
@ -80,6 +84,9 @@ public class ContentSectionManagerTest {
@Inject @Inject
private CategoryRepository categoryRepo; private CategoryRepository categoryRepo;
@Inject
private ContentTypeRepository typeRepo;
public ContentSectionManagerTest() { public ContentSectionManagerTest() {
} }
@ -156,24 +163,23 @@ public class ContentSectionManagerTest {
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml"); .addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
} }
/**
* Check if all injection points work.
*/
@Test @Test
@InSequence(10) @InSequence(1)
public void isRepositoryInjected() { public void checkInjection() {
assertThat(repository, is(not(nullValue()))); assertThat(repository, is(not(nullValue())));
}
@Test
@InSequence(20)
public void isManagerInjected() {
assertThat(manager, is(not(nullValue()))); assertThat(manager, is(not(nullValue())));
}
@Test
@InSequence(30)
public void isRoleRepositoryInjected() {
assertThat(roleRepository, is(not(nullValue()))); assertThat(roleRepository, is(not(nullValue())));
assertThat(confManager, is(not(nullValue())));
assertThat(categoryRepo, is(not(nullValue())));
assertThat(typeRepo, is(not(nullValue())));
} }
/**
* Tries to create a new content section.
*/
@Test @Test
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml") + "ContentSectionManagerTest/data.xml")
@ -196,6 +202,10 @@ public class ContentSectionManagerTest {
manager.createContentSection("test"); manager.createContentSection("test");
} }
/**
* Tries to rename a content section and checks if the content section, its
* root folders and its roles have been renamed to reflect the new name.
*/
@Test @Test
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml") + "ContentSectionManagerTest/data.xml")
@ -231,6 +241,9 @@ public class ContentSectionManagerTest {
categoryRepo.save(section.getRootAssetsFolder()); categoryRepo.save(section.getRootAssetsFolder());
} }
/**
* Tries to add a new role to a content section.
*/
@Test @Test
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml") + "ContentSectionManagerTest/data.xml")
@ -253,6 +266,79 @@ public class ContentSectionManagerTest {
PRIVILEGE_ITEMS_APPROVE); PRIVILEGE_ITEMS_APPROVE);
} }
/**
* Verifies that
* {@link ContentSectionManager#addRoleToContentSection(org.librecms.contentsection.ContentSection, java.lang.String, java.lang.String...)}
* throws a {@link IllegalArgumentException} if the section to which the
* role should be added is {@code null}.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(301)
public void addRoleSectionIsNull() {
manager.addRoleToContentSection(null,
"reviewer",
PRIVILEGE_ITEMS_VIEW_PUBLISHED,
PRIVILEGE_ITEMS_PREVIEW,
PRIVILEGE_ITEMS_APPROVE);
}
/**
* Verifies that
* {@link ContentSectionManager#addRoleToContentSection(org.librecms.contentsection.ContentSection, java.lang.String, java.lang.String...)}
* throws a {@link IllegalArgumentException} if the role to add is
* {@code null}.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(302)
public void addRoleNameIsNull() {
final ContentSection section = repository.findByLabel("info");
manager.addRoleToContentSection(section,
null,
PRIVILEGE_ITEMS_VIEW_PUBLISHED,
PRIVILEGE_ITEMS_PREVIEW,
PRIVILEGE_ITEMS_APPROVE);
}
/**
* Verifies that
* {@link ContentSectionManager#addRoleToContentSection(org.librecms.contentsection.ContentSection, java.lang.String, java.lang.String...)}
* throws a {@link IllegalArgumentException} if the name of the role to add
* is empty.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(302)
public void addRoleNameIsEmpty() {
final ContentSection section = repository.findByLabel("info");
manager.addRoleToContentSection(section,
" ",
PRIVILEGE_ITEMS_VIEW_PUBLISHED,
PRIVILEGE_ITEMS_PREVIEW,
PRIVILEGE_ITEMS_APPROVE);
}
/**
* Tries to remove a role from a content section.
*/
@Test @Test
@UsingDataSet("datasets/org/librecms/contentsection/" @UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml") + "ContentSectionManagerTest/data.xml")
@ -260,7 +346,7 @@ public class ContentSectionManagerTest {
value = "datasets/org/librecms/contentsection/" value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/after-remove-role.xml", + "ContentSectionManagerTest/after-remove-role.xml",
excludeColumns = {"object_id"}) excludeColumns = {"object_id"})
@InSequence(300) @InSequence(350)
public void removeRole() { public void removeRole() {
final ContentSection section = repository.findByLabel("info"); final ContentSection section = repository.findByLabel("info");
final Role role = roleRepository.findByName("info_publisher"); final Role role = roleRepository.findByName("info_publisher");
@ -268,4 +354,275 @@ public class ContentSectionManagerTest {
manager.removeRoleFromContentSection(section, role); manager.removeRoleFromContentSection(section, role);
} }
/**
* Verifies that
* {@link ContentSectionManager#removeRoleFromContentSection(org.librecms.contentsection.ContentSection, org.libreccm.security.Role)}
* throws an {@link IllegalArgumentException} if called with {@code null}
* for the role to remove.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(351)
public void removeRoleNull() {
final ContentSection section = repository.findByLabel("info");
manager.removeRoleFromContentSection(section, null);
}
/**
* Verifies that
* {@link ContentSectionManager#removeRoleFromContentSection(org.librecms.contentsection.ContentSection, org.libreccm.security.Role)}
* throws an {@link IllegalArgumentException} if called with {@code null}
* for the section from which to role is removed.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(352)
public void removeRoleSectionIsNull() {
final Role role = roleRepository.findByName("info_publisher");
manager.removeRoleFromContentSection(null, role);
}
/**
* Tries to add content type to a content section by using
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
*/
@Test
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/after-add-contenttype.xml")
@InSequence(400)
public void addContentTypeToSection() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* does nothing if there is already a {@link ContentType} for the provided
* type in the provided content section.
*/
@Test
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@InSequence(500)
public void addAlreadyAddedTypeToSection() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with {@code null}
* for the type to add.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(600)
public void addTypeToSectionTypeIsNull() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with {@code null}
* for the section of the type to add.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(700)
public void addTypeToSectionSectionIsNull() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with {@code null}
* for the default lifecycle for the type.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(800)
public void addTypeToSectionLifecycleIsNull() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with {@code null}
* for the default workflow of the type to add.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(900)
public void addTypeToSectionWorkflowIsNull() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with a lifecycle
* which does not belong to the provided {@link ContentSection}.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(1000)
public void addTypeToSectionLifecycleNotInSection() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#addContentTypeToSection(java.lang.Class, org.librecms.contentsection.ContentSection, org.librecms.lifecycle.LifecycleDefinition, org.libreccm.workflow.WorkflowTemplate)}.
* throws an {@link IllegalArgumentException} when called with a workflow
* which does not belong to the provided {@link ContentSection}.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(1100)
public void addTypeToSectionWorkflowNoInSection() {
fail();
}
/**
* Verifies the return value of
* {@link ContentSectionManager#hasContentType(java.lang.Class, org.librecms.contentsection.ContentSection)}.
*/
@Test
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/after-add-contenttype.xml")
@InSequence(1200)
public void verifyHasContentType() {
fail();
}
/**
* Tries to remove an unused content type from a section.
*/
@Test
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/after-remove-contenttype.xml")
@InSequence(1300)
public void removeContentTypeFromSection() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#removeContentTypeFromSection(java.lang.Class, org.librecms.contentsection.ContentSection)}
* does nothing if the provided section has no {@link ContentType} for the
* provided subclass of {@link ContentItem}.
*/
@Test
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@InSequence(1301)
public void removeNotExistingContentTypeFromSection() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#removeContentTypeFromSection(java.lang.Class, org.librecms.contentsection.ContentSection)}
* throws a {@link IllegalArgumentException} if the type to delete is still
* in use.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(1400)
public void removeContentTypeFromSectionTypeInUse() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#removeContentTypeFromSection(java.lang.Class, org.librecms.contentsection.ContentSection)}
* throws an {@link IllegalArgumentException} if called with {@code null}
* for the type to remove.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(1400)
public void removeContentTypeFromSectionTypeIsNull() {
fail();
}
/**
* Verifies that
* {@link ContentSectionManager#removeContentTypeFromSection(java.lang.Class, org.librecms.contentsection.ContentSection)}
* throws an {@link IllegalArgumentException} if called with {@code null}
* for the section from which the type is removed.
*/
@Test(expected = IllegalArgumentException.class)
@UsingDataSet("datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldMatchDataSet(
value = "datasets/org/librecms/contentsection/"
+ "ContentSectionManagerTest/data.xml")
@ShouldThrowException(IllegalArgumentException.class)
@InSequence(1400)
public void removeContentTypeFromSectionSectionIsNull() {
fail();
}
} }

View File

@ -479,6 +479,13 @@ CREATE SCHEMA ccm_shortcuts;
primary key (OBJECT_ID) primary key (OBJECT_ID)
); );
create table CCM_CORE.ROLE_DESCRIPTIONS (
ROLE_ID bigint not null,
LOCALIZED_VALUE longvarchar,
LOCALE varchar(255) not null,
primary key (ROLE_ID, LOCALE)
);
create table CCM_CORE.ROLE_MEMBERSHIPS ( create table CCM_CORE.ROLE_MEMBERSHIPS (
MEMBERSHIP_ID bigint not null, MEMBERSHIP_ID bigint not null,
MEMBER_ID bigint, MEMBER_ID bigint,
@ -492,10 +499,10 @@ CREATE SCHEMA ccm_shortcuts;
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_LONG bigint, SETTING_VALUE_LONG bigint,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_DOUBLE double, SETTING_VALUE_DOUBLE double,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
SETTING_VALUE_STRING varchar(1024),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -1016,6 +1023,11 @@ create sequence hibernate_sequence start with 1 increment by 1;
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.ROLE_DESCRIPTIONS
add constraint FKo09bh4j3k3k0ph3awvjwx31ft
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.ROLE_MEMBERSHIPS alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint FK9m88ywi7rcin7b7jrgh53emrq add constraint FK9m88ywi7rcin7b7jrgh53emrq
foreign key (MEMBER_ID) foreign key (MEMBER_ID)

View File

@ -479,6 +479,13 @@ CREATE SCHEMA ccm_shortcuts;
primary key (OBJECT_ID) primary key (OBJECT_ID)
); );
create table CCM_CORE.ROLE_DESCRIPTIONS (
ROLE_ID int8 not null,
LOCALIZED_VALUE text,
LOCALE varchar(255) not null,
primary key (ROLE_ID, LOCALE)
);
create table CCM_CORE.ROLE_MEMBERSHIPS ( create table CCM_CORE.ROLE_MEMBERSHIPS (
MEMBERSHIP_ID int8 not null, MEMBERSHIP_ID int8 not null,
MEMBER_ID int8, MEMBER_ID int8,
@ -492,10 +499,10 @@ CREATE SCHEMA ccm_shortcuts;
CONFIGURATION_CLASS varchar(512) not null, CONFIGURATION_CLASS varchar(512) not null,
NAME varchar(512) not null, NAME varchar(512) not null,
SETTING_VALUE_LONG int8, SETTING_VALUE_LONG int8,
SETTING_VALUE_STRING varchar(1024),
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_DOUBLE float8, SETTING_VALUE_DOUBLE float8,
SETTING_VALUE_BOOLEAN boolean,
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
SETTING_VALUE_STRING varchar(1024),
primary key (SETTING_ID) primary key (SETTING_ID)
); );
@ -1016,6 +1023,11 @@ create sequence hibernate_sequence start 1 increment 1;
foreign key (OBJECT_ID) foreign key (OBJECT_ID)
references CCM_CORE.CCM_OBJECTS; references CCM_CORE.CCM_OBJECTS;
alter table CCM_CORE.ROLE_DESCRIPTIONS
add constraint FKo09bh4j3k3k0ph3awvjwx31ft
foreign key (ROLE_ID)
references CCM_CORE.CCM_ROLES;
alter table CCM_CORE.ROLE_MEMBERSHIPS alter table CCM_CORE.ROLE_MEMBERSHIPS
add constraint FK9m88ywi7rcin7b7jrgh53emrq add constraint FK9m88ywi7rcin7b7jrgh53emrq
foreign key (MEMBER_ID) foreign key (MEMBER_ID)