CCM NG: Several changes in the tests caused by the recent changes to the Shiro integration and other changes.
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3945 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
faacb47dd1
commit
c2bae7824a
|
|
@ -21,10 +21,6 @@
|
||||||
<filter-mapping>
|
<filter-mapping>
|
||||||
<filter-name>ShiroFilter</filter-name>
|
<filter-name>ShiroFilter</filter-name>
|
||||||
<url-pattern>/*</url-pattern>
|
<url-pattern>/*</url-pattern>
|
||||||
<!--<dispatcher>REQUEST</dispatcher>
|
|
||||||
<dispatcher>FORWARD</dispatcher>
|
|
||||||
<dispatcher>INCLUDE</dispatcher>
|
|
||||||
<dispatcher>ERROR</dispatcher>-->
|
|
||||||
</filter-mapping>
|
</filter-mapping>
|
||||||
|
|
||||||
<listener>
|
<listener>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
--------------
|
||||||
|
Overview
|
||||||
|
--------------
|
||||||
|
Jens Pelzetter
|
||||||
|
--------------
|
||||||
|
2016-03-18
|
||||||
|
--------------
|
||||||
|
|
||||||
|
LibreCCM Bundle Web for Wildfly
|
||||||
|
|
||||||
|
This module provides the web application part of the the LibreCCM devel
|
||||||
|
bundle for the Wildfly application server.
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
<?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 LibreCCM Devel Bundle Web module" href="index.html"/>
|
||||||
|
</menu>
|
||||||
|
|
||||||
|
<menu ref="reports"/>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
--------------
|
||||||
|
Overview
|
||||||
|
--------------
|
||||||
|
Jens Pelzetter
|
||||||
|
--------------
|
||||||
|
2016-03-18
|
||||||
|
--------------
|
||||||
|
|
||||||
|
LibreCCM Bundle for Wildfly
|
||||||
|
|
||||||
|
This module provides the LibreCCM devel bundle for the Wildfly application
|
||||||
|
server.
|
||||||
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?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 LibreCCM Devel Bundle module" href="index.html"/>
|
||||||
|
</menu>
|
||||||
|
|
||||||
|
<menu ref="reports"/>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</project>
|
||||||
|
|
||||||
|
|
@ -284,7 +284,7 @@
|
||||||
<goal>report</goal>
|
<goal>report</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<!--<execution>
|
||||||
<id>default-check</id>
|
<id>default-check</id>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>check</goal>
|
<goal>check</goal>
|
||||||
|
|
@ -303,7 +303,7 @@
|
||||||
</rule>
|
</rule>
|
||||||
</rules>
|
</rules>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>-->
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
@ -1005,6 +1005,10 @@
|
||||||
<artifactId>arquillian-jacoco</artifactId>
|
<artifactId>arquillian-jacoco</artifactId>
|
||||||
<version>1.0.0.Alpha8</version>
|
<version>1.0.0.Alpha8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.saxon</groupId>
|
||||||
|
<artifactId>Saxon-HE</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ public class CCMTransformerFactory extends TransformerFactory {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
//Get an XMLConfig instance
|
//Get an XMLConfig instance
|
||||||
final XmlConfig config = XmlConfig.getConfig();
|
final XmlConfig config = retrieveXmlConfig();
|
||||||
//Get the classname
|
//Get the classname
|
||||||
final String classname = config.getXslTransformerFactoryClassname();
|
final String classname = config.getXslTransformerFactoryClassname();
|
||||||
LOGGER.warn(String.format("XSL Transformer Factory classname is %s",
|
LOGGER.warn(String.format("XSL Transformer Factory classname is %s",
|
||||||
|
|
@ -69,6 +69,18 @@ public class CCMTransformerFactory extends TransformerFactory {
|
||||||
} else {
|
} else {
|
||||||
factory = TransformerFactory.newInstance(classname, null);
|
factory = TransformerFactory.newInstance(classname, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private XmlConfig retrieveXmlConfig() {
|
||||||
|
try {
|
||||||
|
return XmlConfig.getConfig();
|
||||||
|
} catch (IllegalStateException ex) {
|
||||||
|
LOGGER.warn(
|
||||||
|
"Failed to access registry (CDI container not available?).",
|
||||||
|
ex);
|
||||||
|
return new XmlConfig();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,10 @@ import org.libreccm.core.AbstractEntityRepository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.NoResultException;
|
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -53,6 +53,11 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
return entity.getObjectId() == 0;
|
return entity.getObjectId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initNewEntity(final Category category) {
|
||||||
|
category.setUuid(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves a list of all top level categories (Categories without a parent
|
* Retrieves a list of all top level categories (Categories without a parent
|
||||||
* category).
|
* category).
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ public class CdiUtil {
|
||||||
} catch(NamingException ex) {
|
} catch(NamingException ex) {
|
||||||
throw new IllegalStateException("Unable to lookup BeanManager.", ex);
|
throw new IllegalStateException("Unable to lookup BeanManager.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityGraph;
|
import javax.persistence.EntityGraph;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.Query;
|
|
||||||
import javax.persistence.TypedQuery;
|
import javax.persistence.TypedQuery;
|
||||||
import javax.persistence.criteria.CriteriaBuilder;
|
import javax.persistence.criteria.CriteriaBuilder;
|
||||||
import javax.persistence.criteria.CriteriaQuery;
|
import javax.persistence.criteria.CriteriaQuery;
|
||||||
|
|
@ -277,12 +276,24 @@ public abstract class AbstractEntityRepository<K, E> {
|
||||||
*/
|
*/
|
||||||
public void save(final E entity) {
|
public void save(final E entity) {
|
||||||
if (isNew(entity)) {
|
if (isNew(entity)) {
|
||||||
|
initNewEntity(entity);
|
||||||
entityManager.persist(entity);
|
entityManager.persist(entity);
|
||||||
} else {
|
} else {
|
||||||
entityManager.merge(entity);
|
entityManager.merge(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overwrite this method to initialise new entities with default values.
|
||||||
|
* One example is assigning a (random) UUID to new entity which implements
|
||||||
|
* the {@link Identifiable} interface.
|
||||||
|
*
|
||||||
|
* @param entity The entity to init.
|
||||||
|
*/
|
||||||
|
public void initNewEntity(final E entity) {
|
||||||
|
//Empty default implementation
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes an entity from the database.
|
* Deletes an entity from the database.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@ package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
import static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
import javax.enterprise.context.RequestScoped;
|
import javax.enterprise.context.RequestScoped;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -52,6 +54,9 @@ public class CcmObjectRepository extends AbstractEntityRepository<Long, CcmObjec
|
||||||
return entity.getObjectId() == 0;
|
return entity.getObjectId() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initNewEntity(final CcmObject entity) {
|
||||||
|
entity.setUuid(UUID.randomUUID().toString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ import javax.persistence.EntityManager;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
class ModuleEvent {
|
public class ModuleEvent {
|
||||||
|
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,7 @@ public class CategoryManagerTest {
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
value = "datasets/org/libreccm/categorization/"
|
value = "datasets/org/libreccm/categorization/"
|
||||||
+ "CategoryManagerTest/after-add-subcategory.yml",
|
+ "CategoryManagerTest/after-add-subcategory.yml",
|
||||||
excludeColumns = {"object_id"})
|
excludeColumns = {"object_id", "uuid"})
|
||||||
@InSequence(2100)
|
@InSequence(2100)
|
||||||
public void addSubCategoryToCategory() {
|
public void addSubCategoryToCategory() {
|
||||||
final Category category = new Category();
|
final Category category = new Category();
|
||||||
|
|
@ -242,7 +242,8 @@ public class CategoryManagerTest {
|
||||||
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
"datasets/org/libreccm/categorization/CategoryManagerTest/data.yml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
value = "datasets/org/libreccm/categorization/CategoryManagerTest/"
|
value = "datasets/org/libreccm/categorization/CategoryManagerTest/"
|
||||||
+ "after-create-multiple-categories.yml")
|
+ "after-create-multiple-categories.yml",
|
||||||
|
excludeColumns = {"object_id", "uuid"})
|
||||||
@InSequence(3100)
|
@InSequence(3100)
|
||||||
public void createMultipleCategories() {
|
public void createMultipleCategories() {
|
||||||
final Domain domain = domainRepo.findByDomainKey("test");
|
final Domain domain = domainRepo.findByDomainKey("test");
|
||||||
|
|
|
||||||
|
|
@ -202,8 +202,9 @@ public class ConfigurationManagerTest {
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
|
value = "datasets/org/libreccm/configuration/"
|
||||||
+ "after-save-new.yml")
|
+ "ConfigurationManagerTest/after-save-new.yml",
|
||||||
|
excludeColumns = {"object_id", "uuid"})
|
||||||
@InSequence(2200)
|
@InSequence(2200)
|
||||||
public void saveNewConfiguration() {
|
public void saveNewConfiguration() {
|
||||||
configurationManager.saveConfiguration(new TestConfiguration());
|
configurationManager.saveConfiguration(new TestConfiguration());
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.core;
|
package org.libreccm.core;
|
||||||
|
|
||||||
import static org.libreccm.core.CoreConstants.*;
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
|
|
||||||
|
|
@ -255,7 +254,7 @@ public class CcmObjectRepositoryTest {
|
||||||
"datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml")
|
"datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml")
|
||||||
@ShouldMatchDataSet(value
|
@ShouldMatchDataSet(value
|
||||||
= "datasets/org/libreccm/core/CcmObjectRepositoryTest/after-save-new.yml",
|
= "datasets/org/libreccm/core/CcmObjectRepositoryTest/after-save-new.yml",
|
||||||
excludeColumns = {"object_id"})
|
excludeColumns = {"object_id", "uuid"})
|
||||||
@InSequence(300)
|
@InSequence(300)
|
||||||
public void saveNewCcmObject() {
|
public void saveNewCcmObject() {
|
||||||
final CcmObject obj = new CcmObject();
|
final CcmObject obj = new CcmObject();
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,12 @@ public class ShiroTest {
|
||||||
.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())
|
||||||
|
.addClass(org.libreccm.modules.CcmModule.class)
|
||||||
|
.addClass(org.libreccm.modules.ModuleEvent.class)
|
||||||
|
.addClass(org.libreccm.modules.InitEvent.class)
|
||||||
|
.addClass(org.libreccm.modules.InstallEvent.class)
|
||||||
|
.addClass(org.libreccm.modules.UnInstallEvent.class)
|
||||||
|
.addClass(org.libreccm.modules.ShutdownEvent.class)
|
||||||
.addPackage(org.libreccm.security.User.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
|
|
@ -124,6 +130,7 @@ public class ShiroTest {
|
||||||
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
|
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
|
||||||
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
|
.addClass(org.libreccm.security.authorization.LabBean.class)
|
||||||
.addAsLibraries(libs)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/persistence.xml")
|
"META-INF/persistence.xml")
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,17 @@
|
||||||
|
|
||||||
<display-name>CcmCoreTest</display-name>
|
<display-name>CcmCoreTest</display-name>
|
||||||
|
|
||||||
|
<filter>
|
||||||
|
<filter-name>ShiroFilter</filter-name>
|
||||||
|
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
|
||||||
|
</filter>
|
||||||
|
|
||||||
|
<filter-mapping>
|
||||||
|
<filter-name>ShiroFilter</filter-name>
|
||||||
|
<url-pattern>/*</url-pattern>
|
||||||
|
</filter-mapping>
|
||||||
|
|
||||||
|
<listener>
|
||||||
|
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
|
||||||
|
</listener>
|
||||||
</web-app>
|
</web-app>
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
<groupId>org.libreccm</groupId>
|
<groupId>org.libreccm</groupId>
|
||||||
<artifactId>ccm-theme-foundry</artifactId>
|
<artifactId>ccm-theme-foundry</artifactId>
|
||||||
|
<version>7.0.0-SNAPSHOT</version>
|
||||||
|
|
||||||
<name>LibreCCM Foundry Theming Engine</name>
|
<name>LibreCCM Foundry Theming Engine</name>
|
||||||
|
|
||||||
|
|
|
||||||
2
pom.xml
2
pom.xml
|
|
@ -134,7 +134,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>3.4</version>
|
<version>3.5</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
<skin>
|
<skin>
|
||||||
<groupId>org.apache.maven.skins</groupId>
|
<groupId>org.apache.maven.skins</groupId>
|
||||||
<artifactId>maven-fluido-skin</artifactId>
|
<artifactId>maven-fluido-skin</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.5</version>
|
||||||
</skin>
|
</skin>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue