CCM NG:
- Database cleanup scripts for tests now running before test methods and not after. This means that the database is still intact after a test is run. Useful for debugging. - ContentSectionSetup now add content types to content section - Some things for the Documents tab in the content centre git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4578 8810af33-2d31-482b-a856-94f89814c4df
parent
c6c137945d
commit
bc466c0618
|
|
@ -22,8 +22,10 @@ import com.arsdigita.bebop.BoxPanel;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.Label;
|
import com.arsdigita.bebop.Label;
|
||||||
import com.arsdigita.bebop.PageState;
|
import com.arsdigita.bebop.PageState;
|
||||||
|
import com.arsdigita.bebop.Text;
|
||||||
import com.arsdigita.bebop.event.PrintEvent;
|
import com.arsdigita.bebop.event.PrintEvent;
|
||||||
import com.arsdigita.bebop.event.PrintListener;
|
import com.arsdigita.bebop.event.PrintListener;
|
||||||
|
import com.arsdigita.bebop.form.Option;
|
||||||
import com.arsdigita.bebop.form.OptionGroup;
|
import com.arsdigita.bebop.form.OptionGroup;
|
||||||
import com.arsdigita.bebop.form.SingleSelect;
|
import com.arsdigita.bebop.form.SingleSelect;
|
||||||
import com.arsdigita.bebop.form.Submit;
|
import com.arsdigita.bebop.form.Submit;
|
||||||
|
|
@ -47,6 +49,7 @@ import org.librecms.contentsection.privileges.TypePrivileges;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TooManyListenersException;
|
import java.util.TooManyListenersException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import org.libreccm.l10n.GlobalizationHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A form element which displays a select box of all content types available
|
* A form element which displays a select box of all content types available
|
||||||
|
|
@ -108,35 +111,41 @@ public abstract class NewItemForm extends Form {
|
||||||
// Read the content section's content types and add them as options
|
// Read the content section's content types and add them as options
|
||||||
@Override
|
@Override
|
||||||
public void prepare(final PrintEvent event) {
|
public void prepare(final PrintEvent event) {
|
||||||
final OptionGroup optionGroup = (OptionGroup) event
|
final OptionGroup target = (OptionGroup) event
|
||||||
.getTarget();
|
.getTarget();
|
||||||
optionGroup.clearOptions();
|
target.clearOptions();
|
||||||
final PageState state = event.getPageState();
|
final PageState state = event.getPageState();
|
||||||
|
|
||||||
// gather the content types of this section into a list
|
// gather the content types of this section into a list
|
||||||
final ContentSection section = getContentSection(state);
|
final ContentSection section = getContentSection(state);
|
||||||
final ContentType parentType;
|
// final ContentType parentType;
|
||||||
final List<ContentType> typesCollection;
|
final List<ContentType> typesCollection;
|
||||||
final Long singleTypeID = (Long) state.getValue(
|
final Long singleTypeID = (Long) state.getValue(
|
||||||
new LongParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
new LongParameter(ItemSearch.SINGLE_TYPE_PARAM));
|
||||||
|
|
||||||
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
final CdiUtil cdiUtil = CdiUtil.createCdiUtil();
|
||||||
|
final NewItemFormController controller = cdiUtil.findBean(
|
||||||
|
NewItemFormController.class);
|
||||||
final ContentTypeRepository typeRepo = cdiUtil.findBean(
|
final ContentTypeRepository typeRepo = cdiUtil.findBean(
|
||||||
ContentTypeRepository.class);
|
ContentTypeRepository.class);
|
||||||
final PermissionChecker permissionChecker = cdiUtil
|
final PermissionChecker permissionChecker = cdiUtil
|
||||||
.findBean(PermissionChecker.class);
|
.findBean(PermissionChecker.class);
|
||||||
|
|
||||||
if (singleTypeID == null) {
|
// if (singleTypeID == null) {
|
||||||
parentType = null;
|
// parentType = null;
|
||||||
} else {
|
// } else {
|
||||||
parentType = typeRepo.findById(singleTypeID).get();
|
// parentType = typeRepo.findById(singleTypeID).get();
|
||||||
}
|
// }
|
||||||
|
// typesCollection = section.getContentTypes().stream()
|
||||||
|
// .filter(type -> permissionChecker.isPermitted(
|
||||||
|
// TypePrivileges.USE_TYPE,
|
||||||
|
// type))
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
typesCollection = controller.getContentTypes(section);
|
||||||
|
|
||||||
typesCollection = section.getContentTypes().stream()
|
typesCollection.forEach(type -> target.addOption(
|
||||||
.filter(type -> permissionChecker.isPermitted(
|
new Option(Long.toString(type.getObjectId()),
|
||||||
TypePrivileges.USE_TYPE,
|
new Text(type.getContentItemClass()))));
|
||||||
type))
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,27 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.ui.authoring;
|
package com.arsdigita.cms.ui.authoring;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import org.librecms.contentsection.ContentSection;
|
import org.librecms.contentsection.ContentSection;
|
||||||
import org.librecms.contentsection.ContentSectionRepository;
|
import org.librecms.contentsection.ContentSectionRepository;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.transaction.Transactional;
|
import javax.transaction.Transactional;
|
||||||
|
import org.libreccm.security.PermissionChecker;
|
||||||
|
import org.libreccm.security.Role;
|
||||||
|
import org.libreccm.security.RoleRepository;
|
||||||
|
import org.libreccm.security.Shiro;
|
||||||
|
import org.libreccm.security.User;
|
||||||
|
import org.librecms.contentsection.ContentType;
|
||||||
|
import org.librecms.contentsection.ContentTypeRepository;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller class for the {@link NewItemForm}.
|
* Controller class for the {@link NewItemForm}.
|
||||||
|
|
@ -39,26 +50,65 @@ class NewItemFormController {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Shiro shiro;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private PermissionChecker permissionChecker;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private RoleRepository roleRepo;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ContentSectionRepository sectionRepo;
|
private ContentSectionRepository sectionRepo;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ContentTypeRepository typeRepo;
|
||||||
|
|
||||||
@Transactional(Transactional.TxType.REQUIRED)
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
protected boolean hasContentTypes(final ContentSection section) {
|
protected boolean hasContentTypes(final ContentSection section) {
|
||||||
Objects.requireNonNull(section, "Can't work with null for the section.");
|
Objects.requireNonNull(section, "Can't work with null for the section.");
|
||||||
|
|
||||||
// final Optional<ContentSection> contentSection = sectionRepo.findById(
|
final Optional<User> user = shiro.getUser();
|
||||||
// section.getObjectId());
|
if (!user.isPresent()) {
|
||||||
//
|
return false;
|
||||||
// if (contentSection.isPresent()) {
|
}
|
||||||
final TypedQuery<Long> query = entityManager.createNamedQuery("ContentSection.countContentTypes", Long.class);
|
|
||||||
|
final List<Role> roles = user.get().getRoleMemberships().stream()
|
||||||
|
.map(membership -> membership.getRole())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
final TypedQuery<Boolean> query = entityManager.createNamedQuery(
|
||||||
|
"ContentSection.hasUsableContentTypes", Boolean.class);
|
||||||
query.setParameter("section", section);
|
query.setParameter("section", section);
|
||||||
return query.getSingleResult() > 0;
|
query.setParameter("roles", roles);
|
||||||
// } else {
|
query.setParameter("isSysAdmin", permissionChecker.isPermitted("*"));
|
||||||
// throw new UnexpectedErrorException(String.format(
|
|
||||||
// "ContentSection %s was passed to this method but does not exist "
|
return query.getSingleResult();
|
||||||
// + "in the database.",
|
}
|
||||||
// Objects.toString(section)));
|
|
||||||
// }
|
@Transactional(Transactional.TxType.REQUIRED)
|
||||||
|
protected List<ContentType> getContentTypes(final ContentSection section) {
|
||||||
|
Objects.requireNonNull(section);
|
||||||
|
|
||||||
|
final Optional<User> user = shiro.getUser();
|
||||||
|
if (!user.isPresent()) {
|
||||||
|
return Collections.EMPTY_LIST;
|
||||||
|
}
|
||||||
|
|
||||||
|
final List<Role> roles = user.get().getRoleMemberships().stream()
|
||||||
|
.map(membership -> membership.getRole())
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
final TypedQuery<ContentType> query = entityManager.createNamedQuery(
|
||||||
|
"ContentSection.findUsableContentTypes",
|
||||||
|
ContentType.class);
|
||||||
|
query.setParameter("section", section);
|
||||||
|
query.setParameter("roles", roles);
|
||||||
|
query.setParameter("isSysAdmin", permissionChecker.isPermitted("*"));
|
||||||
|
|
||||||
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,12 @@ import java.util.ArrayList;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import org.libreccm.workflow.WorkflowTemplate;
|
import org.libreccm.workflow.WorkflowTemplate;
|
||||||
import org.librecms.contentsection.privileges.AssetPrivileges;
|
import org.librecms.contentsection.privileges.AssetPrivileges;
|
||||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||||
|
import org.librecms.contentsection.privileges.TypePrivileges;
|
||||||
import org.librecms.lifecycle.LifecycleDefinition;
|
import org.librecms.lifecycle.LifecycleDefinition;
|
||||||
|
|
||||||
import static org.librecms.CmsConstants.*;
|
import static org.librecms.CmsConstants.*;
|
||||||
|
|
@ -65,14 +67,38 @@ import static org.librecms.CmsConstants.*;
|
||||||
query = "SELECT s FROM ContentSection s WHERE s.label = :label")
|
query = "SELECT s FROM ContentSection s WHERE s.label = :label")
|
||||||
,
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentSection.findContentTypes",
|
name = "ContentSection.findUsableContentTypes",
|
||||||
query = "SELECT t FROM ContentType t WHERE t.contentSection = :section")
|
query = "SELECT t FROM ContentType t "
|
||||||
|
+ "WHERE t.contentSection = :section "
|
||||||
|
+ "AND "
|
||||||
|
+ "(t IN (SELECT p.object FROM Permission p "
|
||||||
|
+ "WHERE p.grantedPrivilege = '"
|
||||||
|
+ TypePrivileges.USE_TYPE + "' "
|
||||||
|
+ "AND p.grantee in :roles) "
|
||||||
|
+ "OR true = :isSysAdmin)")
|
||||||
,
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentSection.countContentTypes",
|
name = "ContentSection.countUsableContentTypes",
|
||||||
query
|
query = "SELECT COUNT(t) FROM ContentType t "
|
||||||
= "SELECT COUNT(t) FROM ContentType t WHERE t.contentSection = :section"
|
+ "WHERE t.contentSection = :section "
|
||||||
)
|
+ "AND "
|
||||||
|
+ "(t IN (SELECT p.object FROM Permission p "
|
||||||
|
+ "WHERE p.grantedPrivilege = '"
|
||||||
|
+ TypePrivileges.USE_TYPE + "' "
|
||||||
|
+ "AND p.grantee IN :roles) "
|
||||||
|
+ "OR true = :isSysAdmin)")
|
||||||
|
,
|
||||||
|
@NamedQuery(
|
||||||
|
name = "ContentSection.hasUsableContentTypes",
|
||||||
|
query = "SELECT (CASE WHEN COUNT(t) > 0 THEN true ELSE false END)"
|
||||||
|
+ "FROM ContentType t "
|
||||||
|
+ "WHERE t.contentSection = :section "
|
||||||
|
+ "AND "
|
||||||
|
+ "(t IN (SELECT p.object FROM Permission p "
|
||||||
|
+ "WHERE p.grantedPrivilege = '"
|
||||||
|
+ TypePrivileges.USE_TYPE + "' "
|
||||||
|
+ "AND p.grantee IN :roles) "
|
||||||
|
+ "OR true = :isSysAdmin)")
|
||||||
,
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "ContentSection.findPermissions",
|
name = "ContentSection.findPermissions",
|
||||||
|
|
@ -149,13 +175,13 @@ public class ContentSection extends CcmApplication implements Serializable {
|
||||||
inverseJoinColumns = {
|
inverseJoinColumns = {
|
||||||
@JoinColumn(name = "ROLE_ID")
|
@JoinColumn(name = "ROLE_ID")
|
||||||
})
|
})
|
||||||
private List<Role> roles;
|
private List<Role> roles = new ArrayList<>();
|
||||||
|
|
||||||
@Column(name = "DEFAULT_LOCALE")
|
@Column(name = "DEFAULT_LOCALE")
|
||||||
private Locale defaultLocale;
|
private Locale defaultLocale;
|
||||||
|
|
||||||
@OneToMany(mappedBy = "contentSection")
|
@OneToMany(mappedBy = "contentSection")
|
||||||
private List<ContentType> contentTypes;
|
private List<ContentType> contentTypes = new ArrayList<>();
|
||||||
|
|
||||||
@OneToMany
|
@OneToMany
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
|
|
@ -168,7 +194,7 @@ public class ContentSection extends CcmApplication implements Serializable {
|
||||||
@JoinColumn(name = "LIFECYCLE_DEFINITION_ID")
|
@JoinColumn(name = "LIFECYCLE_DEFINITION_ID")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
private List<LifecycleDefinition> lifecycleDefinitions;
|
private List<LifecycleDefinition> lifecycleDefinitions = new ArrayList<>();
|
||||||
|
|
||||||
@OneToMany
|
@OneToMany
|
||||||
@JoinTable(
|
@JoinTable(
|
||||||
|
|
@ -181,7 +207,7 @@ public class ContentSection extends CcmApplication implements Serializable {
|
||||||
@JoinColumn(name = "WORKFLOW_TEMPLATE_ID")
|
@JoinColumn(name = "WORKFLOW_TEMPLATE_ID")
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
private List<WorkflowTemplate> workflowTemplates;
|
private List<WorkflowTemplate> workflowTemplates = new ArrayList<>();
|
||||||
|
|
||||||
public ContentSection() {
|
public ContentSection() {
|
||||||
roles = new ArrayList<>();
|
roles = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ import org.librecms.contenttypes.News;
|
||||||
import org.librecms.dispatcher.MultilingualItemResolver;
|
import org.librecms.dispatcher.MultilingualItemResolver;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.logging.Level;
|
import org.librecms.contentsection.privileges.TypePrivileges;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -138,6 +138,10 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
getEntityManager().persist(rootFolder);
|
getEntityManager().persist(rootFolder);
|
||||||
getEntityManager().persist(rootAssetFolder);
|
getEntityManager().persist(rootAssetFolder);
|
||||||
|
|
||||||
|
LOGGER.debug(
|
||||||
|
"Creating default roles and permissions for content section "
|
||||||
|
+ "'{}'...",
|
||||||
|
sectionName);
|
||||||
final Role alertRecipient = createRole(String.format(
|
final Role alertRecipient = createRole(String.format(
|
||||||
"%s_" + ALERT_RECIPIENT, sectionName));
|
"%s_" + ALERT_RECIPIENT, sectionName));
|
||||||
final Role author = createRole(String.format("%s_" + AUTHOR,
|
final Role author = createRole(String.format("%s_" + AUTHOR,
|
||||||
|
|
@ -254,42 +258,75 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
section.addRole(publisher);
|
section.addRole(publisher);
|
||||||
section.addRole(contentReader);
|
section.addRole(contentReader);
|
||||||
|
|
||||||
|
LOGGER.debug("Setting ItemResolver for content section '{}'...",
|
||||||
|
sectionName);
|
||||||
final String itemResolverClassName;
|
final String itemResolverClassName;
|
||||||
if (getIntegrationProps().containsKey(String.format("%s.item_resolver",
|
if (getIntegrationProps().containsKey(String.format("%s.item_resolver",
|
||||||
sectionName))) {
|
sectionName))) {
|
||||||
|
|
||||||
itemResolverClassName = getIntegrationProps().getProperty(
|
itemResolverClassName = getIntegrationProps().getProperty(
|
||||||
String.format("%s.item_resolver",
|
String.format("%s.item_resolver",
|
||||||
sectionName));
|
sectionName));
|
||||||
|
LOGGER.debug("integration.properties contains setting for the item "
|
||||||
|
+ "resolver of content section '{}'. Using "
|
||||||
|
+ "item resolver '{}'.",
|
||||||
|
sectionName, itemResolverClassName);
|
||||||
} else if (getIntegrationProps().containsKey("default_item_resolver")) {
|
} else if (getIntegrationProps().containsKey("default_item_resolver")) {
|
||||||
itemResolverClassName = getIntegrationProps().getProperty(
|
itemResolverClassName = getIntegrationProps().getProperty(
|
||||||
"default_item_resolver_name");
|
"default_item_resolver_name");
|
||||||
|
LOGGER.debug("integration.properties contains setting for the "
|
||||||
|
+ "default item resolver. Using item "
|
||||||
|
+ "resolver '{}'.",
|
||||||
|
itemResolverClassName);
|
||||||
} else {
|
} else {
|
||||||
itemResolverClassName = MultilingualItemResolver.class.getName();
|
itemResolverClassName = MultilingualItemResolver.class.getName();
|
||||||
|
LOGGER.debug("integration.properties contains *no* setting for item "
|
||||||
|
+ "resolver. Using default item resolver '{}'.",
|
||||||
|
itemResolverClassName);
|
||||||
}
|
}
|
||||||
section.setItemResolverClass(itemResolverClassName);
|
section.setItemResolverClass(itemResolverClassName);
|
||||||
|
|
||||||
|
LOGGER.debug("Adding default content types to content section '{}'...",
|
||||||
|
sectionName);
|
||||||
final String[] types;
|
final String[] types;
|
||||||
if (getIntegrationProps().containsKey(String.format("%s.content_types",
|
if (getIntegrationProps().containsKey(String.format("%s.content_types",
|
||||||
sectionName))) {
|
sectionName))) {
|
||||||
final String typesStr = getIntegrationProps().getProperty(String
|
final String typesStr = getIntegrationProps().getProperty(String
|
||||||
.format("%s.content_types", sectionName));
|
.format("%s.content_types", sectionName));
|
||||||
|
LOGGER.debug("integration.properties contains setting for content "
|
||||||
|
+ "types of section '{}': {}",
|
||||||
|
sectionName,
|
||||||
|
typesStr);
|
||||||
types = typesStr.split(",");
|
types = typesStr.split(",");
|
||||||
} else if (getIntegrationProps().containsKey("default_content_types")) {
|
} else if (getIntegrationProps().containsKey("default_content_types")) {
|
||||||
final String typesStr = getIntegrationProps().getProperty(
|
final String typesStr = getIntegrationProps().getProperty(
|
||||||
"default_content_types");
|
"default_content_types");
|
||||||
|
LOGGER.debug("integration.properties contains setting for default "
|
||||||
|
+ "content types for all sections: {}",
|
||||||
|
typesStr);
|
||||||
types = typesStr.split(",");
|
types = typesStr.split(",");
|
||||||
} else {
|
} else {
|
||||||
|
LOGGER.debug("integration.properties contains not settings for "
|
||||||
|
+ "default content types. Using internal default: {}",
|
||||||
|
String.join(", ", DEFAULT_TYPES));
|
||||||
types = DEFAULT_TYPES;
|
types = DEFAULT_TYPES;
|
||||||
}
|
}
|
||||||
Arrays.stream(types).forEach(type -> addContentTypeToSection(section,
|
Arrays.stream(types).forEach(type -> addContentTypeToSection(section,
|
||||||
type));
|
type,
|
||||||
|
author,
|
||||||
|
editor,
|
||||||
|
manager));
|
||||||
|
|
||||||
getEntityManager().merge(section);
|
getEntityManager().merge(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addContentTypeToSection(final ContentSection section,
|
private void addContentTypeToSection(final ContentSection section,
|
||||||
final String contentType) {
|
final String contentType,
|
||||||
|
final Role... roles) {
|
||||||
final String typeClassName = contentType.trim();
|
final String typeClassName = contentType.trim();
|
||||||
|
LOGGER.debug("Adding content type '{}' to content section '{}'...",
|
||||||
|
contentType,
|
||||||
|
section.getPrimaryUrl());
|
||||||
final Class<?> clazz;
|
final Class<?> clazz;
|
||||||
try {
|
try {
|
||||||
clazz = Class.forName(typeClassName);
|
clazz = Class.forName(typeClassName);
|
||||||
|
|
@ -299,10 +336,20 @@ public class ContentSectionSetup extends AbstractCcmApplicationSetup {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ContentItem.class.isAssignableFrom(clazz)) {
|
if (ContentItem.class.isAssignableFrom(clazz)) {
|
||||||
|
LOGGER.warn("'{}' is not is assignable from '{}'!",
|
||||||
|
ContentItem.class.getName(),
|
||||||
|
clazz.getName());
|
||||||
final ContentType type = new ContentType();
|
final ContentType type = new ContentType();
|
||||||
type.setContentSection(section);
|
type.setContentSection(section);
|
||||||
|
type.setUuid(UUID.randomUUID().toString());
|
||||||
type.setContentItemClass(clazz.getName());
|
type.setContentItemClass(clazz.getName());
|
||||||
|
getEntityManager().persist(type);
|
||||||
section.addContentType(type);
|
section.addContentType(type);
|
||||||
|
|
||||||
|
Arrays.stream(roles)
|
||||||
|
.forEach(role -> grantPermission(role,
|
||||||
|
TypePrivileges.USE_TYPE,
|
||||||
|
type));
|
||||||
} else {
|
} else {
|
||||||
throw new UnexpectedErrorException(String.format(
|
throw new UnexpectedErrorException(String.format(
|
||||||
"The class '%s' is not a sub class of '%s'.",
|
"The class '%s' is not a sub class of '%s'.",
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -62,7 +63,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class AttachmentListManagerTest {
|
public class AttachmentListManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -61,7 +62,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentItemL10NManagerTest {
|
public class ContentItemL10NManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
@ -99,8 +101,8 @@ public class ContentItemL10NManagerTest {
|
||||||
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())
|
||||||
|
|
@ -124,28 +126,29 @@ public class ContentItemL10NManagerTest {
|
||||||
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
|
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
|
||||||
.addClass(com.arsdigita.dispatcher.RequestContext.class)
|
.addClass(com.arsdigita.dispatcher.RequestContext.class)
|
||||||
.addClass(com.arsdigita.dispatcher.AccessDeniedException.class)
|
.addClass(com.arsdigita.dispatcher.AccessDeniedException.class)
|
||||||
.addClass(com.arsdigita.cms.dispatcher.ContentItemDispatcher.class)
|
|
||||||
.addClass(com.arsdigita.dispatcher.Dispatcher.class)
|
|
||||||
.addClass(
|
.addClass(
|
||||||
com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class)
|
com.arsdigita.cms.dispatcher.ContentItemDispatcher.class).
|
||||||
|
addClass(com.arsdigita.dispatcher.Dispatcher.class)
|
||||||
.addClass(
|
.addClass(
|
||||||
com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class)
|
com.arsdigita.ui.admin.applications.AbstractAppInstanceForm.class).
|
||||||
.addClass(
|
addClass(
|
||||||
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class)
|
com.arsdigita.ui.admin.applications.AbstractAppSettingsPane.class).
|
||||||
.addClass(
|
addClass(
|
||||||
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class)
|
com.arsdigita.ui.admin.applications.DefaultApplicationInstanceForm.class).
|
||||||
.addClass(org.librecms.dispatcher.ItemResolver.class)
|
addClass(
|
||||||
|
com.arsdigita.ui.admin.applications.DefaultApplicationSettingsPane.class).
|
||||||
|
addClass(org.librecms.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())
|
||||||
.addPackage(org.librecms.contentsection.Asset.class.getPackage())
|
.addPackage(org.librecms.contentsection.Asset.class.getPackage()).
|
||||||
.addPackage(org.librecms.contentsection.AttachmentList.class
|
addPackage(org.librecms.contentsection.AttachmentList.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.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())
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -69,7 +70,8 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentItemManagerTest {
|
public class ContentItemManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
import org.libreccm.security.User;
|
import org.libreccm.security.User;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -68,7 +69,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentItemPermissionTest {
|
public class ContentItemPermissionTest {
|
||||||
|
|
||||||
private static final String QUERY = "SELECT i FROM ContentItem i "
|
private static final String QUERY = "SELECT i FROM ContentItem i "
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
import org.jboss.arquillian.persistence.CreateSchema;
|
import org.jboss.arquillian.persistence.CreateSchema;
|
||||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
import org.jboss.arquillian.persistence.PersistenceTest;
|
||||||
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
import org.jboss.arquillian.persistence.UsingDataSet;
|
import org.jboss.arquillian.persistence.UsingDataSet;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
||||||
|
|
@ -60,7 +61,8 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentItemRepositoryTest {
|
public class ContentItemRepositoryTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
import org.libreccm.workflow.WorkflowTemplate;
|
import org.libreccm.workflow.WorkflowTemplate;
|
||||||
import org.libreccm.workflow.WorkflowTemplateRepository;
|
import org.libreccm.workflow.WorkflowTemplateRepository;
|
||||||
import org.librecms.contentsection.privileges.ItemPrivileges;
|
import org.librecms.contentsection.privileges.ItemPrivileges;
|
||||||
|
|
@ -75,7 +76,8 @@ import org.librecms.lifecycle.LifecycleDefinitionRepository;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentSectionManagerTest {
|
public class ContentSectionManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -63,7 +64,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ContentTypeRepositoryTest {
|
public class ContentTypeRepositoryTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,7 @@ import javax.inject.Inject;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -60,7 +61,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class FolderManagerTest {
|
public class FolderManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ import javax.activation.MimeTypeParseException;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -60,7 +61,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
//@Transactional(TransactionMode.COMMIT)
|
//@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_cms_schema.sql"})
|
@CreateSchema({"create_ccm_cms_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ItemAttachmentManagerTest {
|
public class ItemAttachmentManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,11 @@ public final class CoreConstants {
|
||||||
*/
|
*/
|
||||||
public static final String PRIVILEGE_SYSTEM = "system";
|
public static final String PRIVILEGE_SYSTEM = "system";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name of the system administrator role.
|
||||||
|
*/
|
||||||
|
public static final String SYS_ADMIN_ROLE = "system-administrator";
|
||||||
|
|
||||||
private CoreConstants() {
|
private CoreConstants() {
|
||||||
//Nothing
|
//Nothing
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,47 +70,61 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
||||||
@NamedQueries({
|
@NamedQueries({
|
||||||
@NamedQuery(name = "Role.findByName",
|
@NamedQuery(name = "Role.findByName",
|
||||||
query = "SELECT r FROM Role r "
|
query = "SELECT r FROM Role r "
|
||||||
+ "WHERE r.name = :name"),
|
+ "WHERE r.name = :name")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.count",
|
name = "Role.count",
|
||||||
query = "SELECT COUNT(r) FROM Role r"),
|
query = "SELECT COUNT(r) FROM Role r")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.findAllOrderedByRoleName",
|
name = "Role.findAllOrderedByRoleName",
|
||||||
query = "SELECT r FROM Role r ORDER BY r.name"),
|
query = "SELECT r FROM Role r ORDER BY r.name")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.findAllOrderedByRoleNameLimit",
|
name = "Role.findAllOrderedByRoleNameLimit",
|
||||||
query = "SELECT r FROM Role r ORDER BY r.name "),
|
query = "SELECT r FROM Role r ORDER BY r.name ")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.findAllOrderedByRoleNameDesc",
|
name = "Role.findAllOrderedByRoleNameDesc",
|
||||||
query = "SELECT r FROM Role r ORDER BY r.name DESC"),
|
query = "SELECT r FROM Role r ORDER BY r.name DESC")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.searchByName",
|
name = "Role.searchByName",
|
||||||
query = "SELECT r FROM Role r "
|
query = "SELECT r FROM Role r "
|
||||||
+ "WHERE LOWER(r.name) LIKE CONCAT(LOWER(:name), '%') "
|
+ "WHERE LOWER(r.name) LIKE CONCAT(LOWER(:name), '%') "
|
||||||
+ "ORDER BY r.name "),
|
+ "ORDER BY r.name ")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.searchByNameCount",
|
name = "Role.searchByNameCount",
|
||||||
query = "SELECT COUNT(r.name) FROM Role r "
|
query = "SELECT COUNT(r.name) FROM Role r "
|
||||||
+ "WHERE LOWER(r.name) LIKE CONCAT(LOWER(:name), '%') "
|
+ "WHERE LOWER(r.name) LIKE CONCAT(LOWER(:name), '%') "
|
||||||
+ "GROUP BY r.name "
|
+ "GROUP BY r.name "
|
||||||
+ "ORDER BY r.name "),
|
+ "ORDER BY r.name ")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.findByPrivilege",
|
name = "Role.findByPrivilege",
|
||||||
query = "SELECT r FROM Role r JOIN r.permissions p "
|
query = "SELECT r FROM Role r JOIN r.permissions p "
|
||||||
+ "WHERE p.grantedPrivilege = :privilege "
|
+ "WHERE p.grantedPrivilege = :privilege "
|
||||||
+ "ORDER BY r.name"),
|
+ "ORDER BY r.name")
|
||||||
|
,
|
||||||
@NamedQuery(
|
@NamedQuery(
|
||||||
name = "Role.findByPrivilegeAndObject",
|
name = "Role.findByPrivilegeAndObject",
|
||||||
query = "SELECT r FROM Role r JOIN r.permissions p "
|
query = "SELECT r FROM Role r JOIN r.permissions p "
|
||||||
+ "WHERE p.grantedPrivilege = :privilege "
|
+ "WHERE p.grantedPrivilege = :privilege "
|
||||||
+ "AND p.object = :object "
|
+ "AND p.object = :object "
|
||||||
+ "ORDER BY r.name")
|
+ "ORDER BY r.name")
|
||||||
|
,
|
||||||
|
@NamedQuery(
|
||||||
|
name = "Role.findRolesOfUser",
|
||||||
|
query = "SELECT r.role FROM RoleMembership r "
|
||||||
|
+ "WHERE r.member = :user")
|
||||||
})
|
})
|
||||||
@NamedEntityGraphs({
|
@NamedEntityGraphs({
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = Role.ENTITY_GRPAH_WITH_MEMBERS,
|
name = Role.ENTITY_GRPAH_WITH_MEMBERS,
|
||||||
attributeNodes = {
|
attributeNodes = {
|
||||||
@NamedAttributeNode(value = "memberships"),}),
|
@NamedAttributeNode(value = "memberships"),})
|
||||||
|
,
|
||||||
@NamedEntityGraph(
|
@NamedEntityGraph(
|
||||||
name = Role.ENTITY_GRPAH_WITH_PERMISSIONS,
|
name = Role.ENTITY_GRPAH_WITH_PERMISSIONS,
|
||||||
attributeNodes = {
|
attributeNodes = {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class SystemUsersSetup {
|
||||||
admin.setPassword(adminPassword);
|
admin.setPassword(adminPassword);
|
||||||
|
|
||||||
final Role adminRole = new Role();
|
final Role adminRole = new Role();
|
||||||
adminRole.setName("system-administrator");
|
adminRole.setName(CoreConstants.SYS_ADMIN_ROLE);
|
||||||
|
|
||||||
final RoleMembership membership = new RoleMembership();
|
final RoleMembership membership = new RoleMembership();
|
||||||
membership.setRole(adminRole);
|
membership.setRole(adminRole);
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link CategoryManager}.
|
* Tests for the {@link CategoryManager}.
|
||||||
|
|
@ -70,7 +71,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class CategoryManagerTest {
|
public class CategoryManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -65,7 +66,8 @@ import java.util.Optional;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class CategoryRepositoryTest {
|
public class CategoryRepositoryTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link ConfigurationManager}.
|
* Tests for the {@link ConfigurationManager}.
|
||||||
|
|
@ -62,7 +63,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ConfigurationManagerTest {
|
public class ConfigurationManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link CcmObjectRepository} which is the foundation for many
|
* Tests for the {@link CcmObjectRepository} which is the foundation for many
|
||||||
|
|
@ -67,7 +68,8 @@ import java.util.Optional;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class CcmObjectRepositoryTest {
|
public class CcmObjectRepositoryTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
@ -99,8 +101,8 @@ public class CcmObjectRepositoryTest {
|
||||||
public static WebArchive createDeployment() {
|
public static WebArchive createDeployment() {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war")
|
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.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.configuration.Configuration.class.
|
.addPackage(org.libreccm.configuration.Configuration.class.
|
||||||
|
|
@ -110,10 +112,11 @@ public class CcmObjectRepositoryTest {
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()).
|
||||||
.addPackage(org.libreccm.security.PermissionChecker.class
|
addPackage(org.libreccm.security.PermissionChecker.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
|
||||||
|
getPackage())
|
||||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ import javax.persistence.EntityManager;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -55,7 +56,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ConfigurationLoaderTest {
|
public class ConfigurationLoaderTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
|
||||||
import javax.faces.bean.RequestScoped;
|
import javax.faces.bean.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
|
import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
|
||||||
|
|
||||||
|
|
@ -57,8 +58,8 @@ import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
@RequestScoped
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class CoreDataImportTest {
|
public class CoreDataImportTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -62,7 +63,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class AuthorizationInterceptorTest {
|
public class AuthorizationInterceptorTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -61,7 +62,8 @@ import java.util.Optional;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema("create_ccm_core_schema.sql")
|
@CreateSchema("create_ccm_core_schema.sql")
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ChallengeManagerTest {
|
public class ChallengeManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -59,7 +60,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class GroupManagerTest {
|
public class GroupManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import org.junit.runner.RunWith;
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
import org.libreccm.tests.categories.IntegrationTest;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -65,7 +66,8 @@ import java.util.Optional;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema("create_ccm_core_schema.sql")
|
@CreateSchema("create_ccm_core_schema.sql")
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class GroupRepositoryTest {
|
public class GroupRepositoryTest {
|
||||||
|
|
||||||
private static final String ADMINS = "admins";
|
private static final String ADMINS = "admins";
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -66,7 +67,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema("create_ccm_core_schema.sql")
|
@CreateSchema("create_ccm_core_schema.sql")
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class OneTimeAuthManagerTest {
|
public class OneTimeAuthManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import static org.junit.Assert.assertThat;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -63,7 +64,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class PartyRepositoryTest {
|
public class PartyRepositoryTest {
|
||||||
|
|
||||||
private static final String MMUSTER = "mmuster";
|
private static final String MMUSTER = "mmuster";
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -69,7 +70,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class PermissionCheckerTest {
|
public class PermissionCheckerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import org.libreccm.categorization.CategorizationConstants;
|
||||||
import org.libreccm.core.CoreConstants;
|
import org.libreccm.core.CoreConstants;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Integration tests (run in a Application Server by Arquillian} for the
|
* Integration tests (run in a Application Server by Arquillian} for the
|
||||||
|
|
@ -67,7 +68,8 @@ import java.util.List;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript(value = {"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class PermissionManagerTest {
|
public class PermissionManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -58,7 +59,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class RoleManagerTest {
|
public class RoleManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for the {@link RoleRepository}. Note. We are not enabling the
|
* Tests for the {@link RoleRepository}. Note. We are not enabling the
|
||||||
|
|
@ -69,7 +70,8 @@ import java.util.Optional;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class RoleRepositoryTest {
|
public class RoleRepositoryTest {
|
||||||
|
|
||||||
private static final String ADMINISTRATOR = "administrator";
|
private static final String ADMINISTRATOR = "administrator";
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -65,7 +66,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class SecuredCollectionTest {
|
public class SecuredCollectionTest {
|
||||||
|
|
||||||
private static final String ACCESS_DENIED = "Access denied";
|
private static final String ACCESS_DENIED = "Access denied";
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -66,7 +67,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class SecuredIteratorTest {
|
public class SecuredIteratorTest {
|
||||||
|
|
||||||
private static final String ACCESS_DENIED = "Access denied";
|
private static final String ACCESS_DENIED = "Access denied";
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -64,7 +65,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ShiroTest {
|
public class ShiroTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ import static org.junit.Assert.*;
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.*;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -63,7 +64,8 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class UserManagerTest {
|
public class UserManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -65,7 +66,8 @@ import javax.persistence.PersistenceContext;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class UserRepositoryTest {
|
public class UserRepositoryTest {
|
||||||
|
|
||||||
private static final String NOBODY = "nobody";
|
private static final String NOBODY = "nobody";
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
import org.jboss.arquillian.persistence.CreateSchema;
|
import org.jboss.arquillian.persistence.CreateSchema;
|
||||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
import org.jboss.arquillian.persistence.PersistenceTest;
|
||||||
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
import org.jboss.arquillian.persistence.UsingDataSet;
|
import org.jboss.arquillian.persistence.UsingDataSet;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
||||||
|
|
@ -63,7 +64,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ShortcutManagerTest {
|
public class ShortcutManagerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -59,7 +60,8 @@ import static org.junit.Assert.*;
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
||||||
@CleanupUsingScript({"cleanup.sql"})
|
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ShortcutRepositoryTest {
|
public class ShortcutRepositoryTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue