CCM NG: All tests in ccm-core now pass again

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3824 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-01-23 18:13:28 +00:00
parent 53670572b2
commit cc7889143c
21 changed files with 465 additions and 782 deletions

View File

@ -215,7 +215,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
@ -240,7 +239,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<groups>org.libreccm.tests.categories.UnitTest</groups>
</configuration>
@ -248,7 +246,6 @@
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
<executions>
<execution>
<id>default-prepare-agent</id>
@ -383,7 +380,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
@ -393,7 +390,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.1</version>
<version>3.0.3</version>
<configuration>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
</configuration>
@ -401,11 +398,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.4</version>
<version>3.6</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<targetJdk>1.7</targetJdk>
<targetJdk>1.8</targetJdk>
<rulesets>
<ruleset>/rulesets/java/basic.xml</ruleset>
<ruleset>/rulesets/java/braces.xml</ruleset>
@ -458,7 +455,6 @@
<exclude>**/ExceptionUnwrapper.java</exclude>
<exclude>**/Exceptions.java</exclude>
<exclude>**/FileParameter.java</exclude>
<exclude>**/FormBuilderConfig.java</exclude>
<exclude>**/FullDateFormatter.java</exclude>
<exclude>**/globalization/**</exclude>
<exclude>**/GlobalizationConfig.java</exclude>
@ -466,10 +462,8 @@
<exclude>**/JavaPropertyReader.java</exclude>
<exclude>**/JavaPropertyWriter.java</exclude>
<exclude>**/kernel/**</exclude>
<exclude>**/KernelConfig.java</exclude>
<exclude>**/LockableImpl.java</exclude>
<exclude>**/mail/**</exclude>
<exclude>**/MailConfig.java</exclude>
<exclude>**/MapParameter.java</exclude>
<exclude>**/NotificationConfig.java</exclude>
<exclude>**/Parameter.java</exclude>
@ -477,7 +471,6 @@
<exclude>**/ParameterException.java</exclude>
<exclude>**/RegistryConfig.java</exclude>
<exclude>**/ResourceParameter.java</exclude>
<exclude>**/SecurityConfig.java</exclude>
<exclude>**/SecurityHelper.java</exclude>
<exclude>**/SingletonParameter.java</exclude>
<exclude>**/SpecificClassParameter.java</exclude>
@ -514,7 +507,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<version>2.8.1</version>
<reportSets>
<reportSet>
<reports>
@ -542,13 +535,13 @@
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>arquillian-tomee-embedded</artifactId>
<version>1.7.2</version>
<version>1.7.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-embedded</artifactId>
<version>1.7.2</version>
<version>1.7.3</version>
<scope>test</scope>
<exclusions>
<exclusion>
@ -580,19 +573,19 @@
<dependency>
<groupId>org.jboss.logmanager</groupId>
<artifactId>jboss-logmanager</artifactId>
<version>1.5.4.Final</version>
<version>2.0.3.Final</version>
<scope>test</scope>
</dependency>
<!--Required for WebServices and RESTful WebServices-->
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-webservices</artifactId>
<version>1.7.1</version>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-jaxrs</artifactId>
<version>1.7.1</version>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
@ -652,7 +645,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>
@ -682,12 +675,12 @@
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>arquillian-tomee-remote</artifactId>
<version>1.7.2</version>
<version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>apache-tomee</artifactId>
<version>1.7.2</version>
<version>1.7.3</version>
<classifier>plus</classifier>
<type>zip</type>
</dependency>
@ -733,7 +726,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>
@ -969,7 +962,7 @@
</profile>-->
<profile>
<id>wildfly8-remote-h2-mem</id>
<id>wildfly-remote-h2-mem</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
@ -1030,7 +1023,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>
@ -1052,7 +1045,7 @@
</profile>
<profile>
<id>wildfly8-remote-pgsql</id>
<id>wildfly-remote-pgsql</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
@ -1113,7 +1106,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>
@ -1135,7 +1128,7 @@
</profile>
<profile>
<id>wildfly8-remote-mysql</id>
<id>wildfly-remote-mysql</id>
<dependencies>
<dependency>
<groupId>org.wildfly</groupId>
@ -1196,7 +1189,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
<configuration>
<forkMode>always</forkMode>
<forkCount>999</forkCount>

View File

@ -39,6 +39,7 @@ public final class FormBuilderConfig {
private String controlsHelpUrl;
@Setting
@SuppressWarnings("PMD.LongVariable")
private Boolean interpolateEmailActions;
public static FormBuilderConfig getConfig() {
@ -68,6 +69,7 @@ public final class FormBuilderConfig {
return interpolateEmailActions;
}
@SuppressWarnings("PMD.LongVariable")
public void setInterpolateEmailActions(final Boolean interpolateEmailActions) {
this.interpolateEmailActions = interpolateEmailActions;
}

View File

@ -255,6 +255,13 @@ public final class KernelConfig {
@Override
public String toString() {
final String languages;
if (supportedLanguages == null) {
languages = "";
} else {
languages = supportedLanguages.stream().collect(Collectors.joining(", "));
}
return String.format(
"%s{ "
+ "debugEnabled = %b, "
@ -275,7 +282,8 @@ public final class KernelConfig {
ssoEnabled,
rememberLoginEnabled,
secureLoginEnabled,
supportedLanguages.stream().collect(Collectors.joining(", ")),
//supportedLanguages == null ? "" : supportedLanguages.stream().collect(Collectors.joining(", ")),
languages,
defaultLanguage);
}

View File

@ -68,6 +68,7 @@ public final class XmlConfig {
private String saxParser = "xerces";
@Setting
@SuppressWarnings("PMD.LongVariable")
private Boolean fullTimeFormatterEnabled = false;
public static XmlConfig getConfig() {
@ -100,11 +101,11 @@ public final class XmlConfig {
* Returns the class name of the default {@link TransformerFactory}. This
* method encapsulates the default value so that is easy to change. The
* method is only for use by the classes in the {@code com.arsdigita.xml}
* package, therefore the method is {@code protected}.
* package, therefore the method is visible for the package.
*
* @return
*/
protected String getDefaultXslTransformerFactoryClassname() {
String getDefaultXslTransformerFactoryClassname() {
return SAXON;
}
@ -127,11 +128,10 @@ public final class XmlConfig {
*/
public String getDomBuilderFactoryClassname() {
switch(domBuilder) {
case "resin":
if ("resin".equals(domBuilder)) {
return DOM_RESIN;
default:
return getDefaultDomBuilderFactoryClassname();
} else {
return getDefaultDomBuilderFactoryClassname();
}
}
@ -139,11 +139,11 @@ public final class XmlConfig {
* Returns the class name of the default {@link DocumentBuilderFactory}.
* This method encapsulates the default value so that is easy to change. The method is only for
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
* {@code protected}.
* only accessible from the package.
*
* @return
*/
protected String getDefaultDomBuilderFactoryClassname() {
String getDefaultDomBuilderFactoryClassname() {
return DOM_XERCES;
}
@ -167,11 +167,10 @@ public final class XmlConfig {
*/
public String getSaxParserFactoryClassname() {
switch(saxParser) {
case "resin":
return SAX_RESIN;
default:
return getDefaultSaxParserFactoryClassname();
if ("resin".equals(saxParser)) {
return SAX_RESIN;
} else {
return getDefaultSaxParserFactoryClassname();
}
}
@ -179,11 +178,11 @@ public final class XmlConfig {
* Returns the class name of the default {@link SAXParserFactory}.
* This method encapsulates the default value so that is easy to change. The method is only for
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
* {@code protected}.
* only visible in the package.
*
* @return
*/
protected String getDefaultSaxParserFactoryClassname() {
String getDefaultSaxParserFactoryClassname() {
return SAX_XERCES;
}
@ -196,6 +195,7 @@ public final class XmlConfig {
return fullTimeFormatterEnabled;
}
@SuppressWarnings("PMD.LongVariable")
public void setFullTimeFormatterEnabled(
final Boolean fullTimeFormatterEnabled) {
this.fullTimeFormatterEnabled = fullTimeFormatterEnabled;

View File

@ -39,7 +39,7 @@ import javax.persistence.TypedQuery;
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
private static final Logger LOGGER = LogManager.getLogger(
CategoryRepository.class);
CategoryRepository.class);
@Inject
private DomainRepository domainRepo;
@ -62,7 +62,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
*/
public List<Category> getTopLevelCategories() {
final TypedQuery<Category> query = getEntityManager().createNamedQuery(
"Category.topLevelCategories", Category.class);
"Category.topLevelCategories", Category.class);
return query.getResultList();
}
@ -75,14 +75,14 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
final String[] tokens = path.split(":");
if (tokens.length > 2) {
throw new InvalidCategoryPathException(
"The provided path is invalid: More than one colon found. "
+ "Valid path format: domainKey:path");
"The provided path is invalid: More than one colon found. "
+ "Valid path format: domainKey:path");
}
if (tokens.length < 2) {
throw new InvalidCategoryPathException(
"The provided path is invalid: No domain found in path. "
+ "Valid path format: domainKey:path");
"The provided path is invalid: No domain found in path. "
+ "Valid path format: domainKey:path");
}
final Domain domain;
@ -90,8 +90,8 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
domain = domainRepo.findByDomainKey(tokens[0]);
} catch (NoResultException ex) {
throw new InvalidCategoryPathException(String.format(
"No domain identified by the key '%s' found.",
tokens[0]),
"No domain identified by the key '%s' found.",
tokens[0]),
ex);
}
@ -108,7 +108,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
}
String normalizedPath = path.replace('.', '/');
if (normalizedPath.startsWith("/")) {
if (normalizedPath.charAt(0) == '/') {
normalizedPath = normalizedPath.substring(1);
}
@ -118,28 +118,29 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
}
LOGGER.debug(String.format(
"Trying to find category with path \"%s\" in "
+ "domain \"%s\".",
normalizedPath,
domain.getDomainKey()));
"Trying to find category with path \"%s\" in "
+ "domain \"%s\".",
normalizedPath,
domain.getDomainKey()));
final String[] tokens = normalizedPath.split("/");
Category current = domain.getRoot();
for (String token : tokens) {
for (final String token : tokens) {
if (current.getSubCategories() == null) {
return null;
}
final Optional<Category> result = current.getSubCategories()
.stream()
.filter((c) -> {
LOGGER.debug(new FormattedMessage(
"#findByPath(Domain, String): c = %s", c.toString()));
LOGGER.debug(new FormattedMessage(
"#findByPath(Domain, String): c.getName = \"%s\"", c.getName()));
LOGGER.debug(new FormattedMessage(
"#findByPath(Domain, String): token = \"%s\"", token));
return c.getName().equals(token);
})
.findFirst();
.stream()
.filter((c) -> {
LOGGER.debug("#findByPath(Domain, String): c = {}",
c.toString());
LOGGER.debug(
"#findByPath(Domain, String): c.getName = \"{}\"",
c.getName());
LOGGER.debug("#findByPath(Domain, String): token = \"{}\"",
token);
return c.getName().equals(token);
})
.findFirst();
if (result.isPresent()) {
current = result.get();
} else {
@ -155,7 +156,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
* subcategory or the an {@link Domain} as root category.
*
* @return A list of all orphaned categories. Normally this list should be
* empty.
* empty.
*/
public List<Category> getOrphanedCategories() {
// TODO implement method

View File

@ -51,6 +51,11 @@ import javax.persistence.EntityManager;
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@RequestScoped
@SuppressWarnings({"PMD.GodClass",
"PMD.TooManyMethods",
"PMD.LongVariable",
"PMD.ModifiedCyclomaticComplexity",
"PMD.StandardCyclomaticComplexity",})
public class ConfigurationManager {
private static final Logger LOGGER = LogManager.getLogger(
@ -307,6 +312,9 @@ public class ConfigurationManager {
*
* @return The {@link SettingInfo} for the provided configuration class.
*/
@SuppressWarnings({"PMD.NPathComplexity",
"PMD.CyclomaticComplexity",
"PMD.StandardCyclomaticComplexity"})
public SettingInfo getSettingInfo(final Class<?> configuration,
final String name) {
if (configuration == null) {
@ -376,9 +384,9 @@ public class ConfigurationManager {
settingInfo.setDescBundle(descBundle);
if (settingAnnotation.labelKey() == null
|| settingAnnotation.labelKey().isEmpty()) {
|| settingAnnotation.labelKey().isEmpty()) {
settingInfo.setLabelKey(String.join(".", field.getName(),
"label"));
"label"));
} else {
settingInfo.setLabelKey(name);
}
@ -578,25 +586,6 @@ public class ConfigurationManager {
setting.setDisplayName(settingName);
final Category category = findCategoryForNewSetting(configuration);
categoryManager.addObjectToCategory(setting, category);
// final Domain registry = domainRepository
// .findByDomainKey(REGISTRY_DOMAIN);
// Category category = categoryRepository
// .findByPath(registry, configuration.getClass().getName());
// if (category == null) {
// final String[] tokens = configuration.getClass().getName().
// split("\\.");
// final StringBuilder categoryPath = new StringBuilder(
// configuration.getClass().getName().length());
// for (String token : tokens) {
// if (categoryPath.length() > 0) {
// categoryPath.append('.');
// }
// categoryPath.append(token);
// category = createCategoryIfNotExists(categoryPath.toString());
// }
// }
// categoryManager.addObjectToCategory(setting, category);
}
LOGGER.debug(String.format("New value of setting \"%s\" is: \"%s\"",
@ -705,17 +694,16 @@ public class ConfigurationManager {
settingType);
if (setting != null) {
try {
LOGGER.debug(String.
format("Setting \"%s\" found. Value: %s",
settingPath,
setting.getValue().toString()));
LOGGER.debug("Setting \"{}\" found. Value: %s",
settingPath,
setting.getValue().toString());
field.set(conf, setting.getValue());
} catch (IllegalAccessException ex) {
LOGGER.warn(String.format(
"Failed to set value of configuration class \"%s\". "
LOGGER.warn(
"Failed to set value of configuration class \"{}\". "
+ "Ignoring.",
confClass.getName()),
ex);
confClass.getName(),
ex);
}
}
}
@ -724,10 +712,9 @@ public class ConfigurationManager {
}
private Category findCategoryForNewSetting(final Object configuration) {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Looking for category for "
+ "configuration \"%s\"...",
configuration.getClass().getName()));
LOGGER.debug("#findCategoryForNewSetting: Looking for category for "
+ "configuration \"{}\"...",
configuration.getClass().getName());
final String categoryPath = configuration.getClass().getName();
final String[] tokens = categoryPath.split("\\.");
final Domain registry = domainRepository
@ -739,20 +726,20 @@ public class ConfigurationManager {
final boolean[] exists = new boolean[tokens.length];
for (int i = 0; i < tokens.length; i++) {
final String path = buildCategoryPath(tokens, i);
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Checking if category \"%s\" exists.",
path));
LOGGER.debug("#findCategoryForNewSetting: "
+ "Checking if category \"{}\" exists.",
path);
final Category category = categoryRepository.findByPath(registry,
path);
if (category == null) {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Category \"%s\" does not exist.",
path));
LOGGER.debug("#findCategoryForNewSetting: "
+ "Category \"{}\" does not exist.",
path);
exists[i] = false;
} else {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Category \"%s\" exists.",
path));
LOGGER.debug(
"#findCategoryForNewSetting: Category \"{}\" exists.",
path);
exists[i] = true;
categories[i] = category;
}
@ -761,33 +748,34 @@ public class ConfigurationManager {
LOGGER.debug(
"#findCategoryForNewSetting: Creating missing categories...");
for (int i = 0; i < tokens.length; i++) {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Checking for category \"%s\"...",
tokens[i]));
LOGGER.debug(
"#findCategoryForNewSetting: Checking for category \"{}\"...",
tokens[i]);
if (!exists[i]) {
if (i == 0) {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Category \"%s\" does not exist, "
+ "creating as subcategory of the registry root category.",
tokens[i]));
LOGGER.debug("#findCategoryForNewSetting: "
+ "Category \"{}\" does not exist, "
+ "creating as subcategory of the registry "
+ "root category.",
tokens[i]);
categories[i] = createNewCategory(tokens[i],
registry.getRoot());
} else {
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Category \"%s\" does not exist, "
+ "creating as subcategory of \"%s\"",
tokens[i],
categories[i - 1].getName()));
LOGGER.debug("#findCategoryForNewSetting: "
+ "Category \"{}\" does not exist, "
+ "creating as subcategory of \"{}\"",
tokens[i],
categories[i - 1].getName());
categories[i] = createNewCategory(tokens[i],
categories[i - 1]);
}
}
}
LOGGER.debug(new FormattedMessage(
"#findCategoryForNewSetting: Found/Created category \"%s\".",
categoryPath));
LOGGER.debug("#findCategoryForNewSetting: "
+ "Found/Created category \"{}\".",
categoryPath);
return categories[categories.length - 1];
}

View File

@ -155,16 +155,40 @@ public final class SettingInfo {
if (!Objects.equals(name, other.getName())) {
return false;
}
if (!Objects.equals(valueType, other.getValueType())) {
return false;
}
if (!Objects.equals(defaultValue, other.getDefaultValue())) {
// if (!Objects.equals(valueType, other.getValueType())) {
// return false;
// }
// if (!Objects.equals(defaultValue, other.getDefaultValue())) {
// return false;
// }
if (!equalsValueProps(other)) {
return false;
}
if (!Objects.equals(confClass, other.getConfClass())) {
return false;
}
// if (!Objects.equals(descBundle, other.getDescBundle())) {
// return false;
// }
//
// if (!Objects.equals(labelKey, other.getLabelKey())) {
// return false;
// }
//
// return Objects.equals(descKey, other.getDescKey());
return equalsDescProps(other);
}
private boolean equalsValueProps(final SettingInfo other) {
if (!Objects.equals(valueType, other.getValueType())) {
return false;
}
return Objects.equals(defaultValue, other.getDefaultValue());
}
private boolean equalsDescProps(final SettingInfo other) {
if (!Objects.equals(descBundle, other.getDescBundle())) {
return false;
}

View File

@ -76,7 +76,7 @@ public class StringListSetting extends AbstractSetting<List<String>> {
}
@Override
public boolean equals(Object obj) {
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}

View File

@ -1,216 +0,0 @@
/*
* Copyright (C) 2015 LibreCCM Foundation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
package org.libreccm.configuration;
import com.example.TestConfiguration;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.arquillian.persistence.CreateSchema;
import org.jboss.arquillian.persistence.PersistenceTest;
import org.jboss.arquillian.persistence.UsingDataSet;
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
import org.jboss.arquillian.transaction.api.annotation.Transactional;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
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.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.core.CcmObject;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.Permission;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.File;
import java.math.BigDecimal;
import javax.inject.Inject;
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@org.junit.experimental.categories.Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"create_ccm_core_schema.sql"})
public class ConfigurationManagerBTest {
@Inject
private ConfigurationManager configurationManager;
public ConfigurationManagerBTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Deployment
public static WebArchive createDeployment() {
final PomEquippedResolveStage pom = Maven
.resolver()
.loadPomFromFile("pom.xml");
final PomEquippedResolveStage dependencies = pom
.importCompileAndRuntimeDependencies();
final File[] libs = dependencies.resolve().withTransitivity().asFile();
for (File lib : libs) {
System.err.printf("Adding file '%s' to test archive...%n",
lib.getName());
}
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.categorization.ConfigurationManagerBTest.war")
.addPackage("org.libreccm.categorization")
.addPackage("org.libreccm.configuration")
.addPackage("org.libreccm.core")
.addPackage("org.libreccm.jpa")
.addPackage("org.libreccm.jpa.utils")
.addPackage("org.libreccm.l10n")
.addPackage("org.libreccm.security")
.addPackage("org.libreccm.tests.categories")
.addPackage("org.libreccm.testutils")
.addPackage("org.libreccm.web")
.addPackage("org.libreccm.workflow")
.addPackage("com.example")
//--
.addPackage("org.libreccm.cdi.utils")
.addPackage("org.libreccm.modules")
.addPackage("com.arsdigita.kernel")
.addPackage("com.arsdigita.kernel.security")
.addPackage("com.arsdigita.util")
.addPackage("com.arsdigita.util.parameter")
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource(
"configs/org/libreccm/configuration/ConfigurationManagerTest/"
+ "log4j2.xml",
"log4j2.xml")
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
}
@Test
@InSequence(1)
public void managerIsInjected() {
assertThat(configurationManager, is(not(nullValue())));
}
@Test
@UsingDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
@InSequence(2)
public void datasetOnly() {
System.out.println("Dataset loaded successfully.");
}
@Test
@UsingDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
@InSequence(1100)
public void loadConfiguration() {
final ExampleConfiguration configuration = configurationManager
.findConfiguration(ExampleConfiguration.class);
assertThat(configuration, is(not(nullValue())));
assertThat(configuration.getPrice(),
is(equalTo(new BigDecimal("98.99"))));
assertThat(configuration.isEnabled(), is(true));
assertThat(configuration.getMinTemperature(), is(23.5));
assertThat(configuration.getItemsPerPage(), is(20L));
assertThat(configuration.getHelpUrl(),
is(equalTo("http://www.example.org")));
assertThat(configuration.getLanguages().size(), is(2));
assertThat(configuration.getLanguages(), hasItem("de"));
assertThat(configuration.getLanguages(), hasItem("en"));
}
@Test
@UsingDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
@ShouldMatchDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
+ "after-save-changed.yml")
@InSequence(1200)
public void saveConfiguration() {
final ExampleConfiguration configuration = configurationManager
.findConfiguration(ExampleConfiguration.class);
configuration.setPrice(new BigDecimal("109.99"));
configuration.setItemsPerPage(30L);
configuration.addLanguage("es");
configurationManager.saveConfiguration(configuration);
}
@Test
@UsingDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
@InSequence(2100)
public void loadNewConfiguration() {
final TestConfiguration configuration = configurationManager
.findConfiguration(TestConfiguration.class);
assertThat(configuration, is(nullValue()));
}
@Test
@UsingDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
@ShouldMatchDataSet(
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
+ "after-save-new.yml")
@InSequence(2200)
public void saveNewConfiguration() {
configurationManager.saveConfiguration(new TestConfiguration());
}
}

View File

@ -53,7 +53,11 @@ import java.io.File;
import java.math.BigDecimal;
import javax.inject.Inject;
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
import org.libreccm.categorization.Category;
import javax.persistence.TypedQuery;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@ -192,7 +196,9 @@ public class ConfigurationManagerTest {
final TestConfiguration configuration = configurationManager
.findConfiguration(TestConfiguration.class);
assertThat(configuration, is(nullValue()));
assertThat(configuration, is(not(nullValue())));
assertThat(configuration.getEnabled(), is(false));
assertThat(configuration.getItemsPerPage(), is(40L));
}
@Test

View File

@ -112,9 +112,9 @@ public class AuthorizationInterceptorTest {
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
@ -123,9 +123,9 @@ public class AuthorizationInterceptorTest {
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.security.authorization.LabBean.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class

View File

@ -120,36 +120,27 @@ public class GroupManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.GroupManagerTest.war")
.addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

View File

@ -18,13 +18,6 @@
*/
package org.libreccm.security;
import com.arsdigita.kernel.security.SecurityConfig;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.AbstractParameterContext;
import com.arsdigita.web.CCMApplicationContextListener;
import com.arsdigita.xml.XML;
import com.arsdigita.xml.formatters.DateTimeFormatter;
import static org.libreccm.core.CoreConstants.*;
import java.io.File;
@ -56,19 +49,10 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.util.ArrayList;
import java.util.List;
@ -133,54 +117,37 @@ public class PermissionCheckerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.PermissionCheckerTest.war").
addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(CdiUtil.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
"LibreCCM-org.libreccm.security.PermissionCheckerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties",
"com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource(
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
"log4j2.xml")
.addAsWebInfResource(
"configs/org/libreccm/security/ShiroTest/"
+ "kernel.properties",
"conf/registry/ccm-core/kernel.properties")
.addAsWebInfResource(
"configs/org/libreccm//security/ShiroTest/"
+ "security.properties",
"conf/registry/ccm-core/security.properties")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

View File

@ -18,12 +18,6 @@
*/
package org.libreccm.security;
import com.arsdigita.kernel.security.SecurityConfig;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.AbstractParameterContext;
import com.arsdigita.web.CCMApplicationContextListener;
import com.arsdigita.xml.XML;
import com.arsdigita.xml.formatters.DateTimeFormatter;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
@ -47,16 +41,9 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.File;
@ -125,36 +112,30 @@ public class PermissionManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.PermissionManagerTest.war")
.addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

View File

@ -18,13 +18,6 @@
*/
package org.libreccm.security;
import com.arsdigita.kernel.security.SecurityConfig;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.AbstractParameterContext;
import com.arsdigita.web.CCMApplicationContextListener;
import com.arsdigita.xml.XML;
import com.arsdigita.xml.formatters.DateTimeFormatter;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.junit.Arquillian;
@ -47,15 +40,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.core.CcmObject;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.File;
@ -120,36 +105,30 @@ public class RoleManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.RoleManagerTest.war")
.addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");

View File

@ -150,54 +150,36 @@ public class SecuredCollectionTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.SecuredCollectionTest.war").
addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(CdiUtil.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
"LibreCCM-org.libreccm.security.SecuredCollectionTest.war")
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties",
"com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource(
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
"log4j2.xml")
.addAsWebInfResource(
"configs/org/libreccm/security/ShiroTest/"
+ "kernel.properties",
"conf/registry/ccm-core/kernel.properties")
.addAsWebInfResource(
"configs/org/libreccm//security/ShiroTest/"
+ "security.properties",
"conf/registry/ccm-core/security.properties")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

View File

@ -18,12 +18,6 @@
*/
package org.libreccm.security;
import com.arsdigita.kernel.security.SecurityConfig;
import com.arsdigita.util.UncheckedWrapperException;
import com.arsdigita.util.parameter.AbstractParameterContext;
import com.arsdigita.web.CCMApplicationContextListener;
import com.arsdigita.xml.XML;
import com.arsdigita.xml.formatters.DateTimeFormatter;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
@ -47,17 +41,9 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.cdi.utils.CdiUtil;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.File;
import java.util.ArrayList;
@ -151,53 +137,35 @@ public class SecuredIteratorTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.SecuredIteratorTest.war")
.addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(CdiUtil.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties",
"com/arsdigita/kernel/"
+ "KernelConfig_parameter.properties")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource(
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
"log4j2.xml")
.addAsWebInfResource(
"configs/org/libreccm/security/ShiroTest/"
+ "kernel.properties",
"conf/registry/ccm-core/kernel.properties")
.addAsWebInfResource(
"configs/org/libreccm//security/ShiroTest/"
+ "security.properties",
"conf/registry/ccm-core/security.properties")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

View File

@ -105,47 +105,25 @@ public class ShiroTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.ShiroTest.war")
.addPackage("org.libreccm.cdi.utils") //Checked
.addPackage("org.libreccm.categorization") //Checked
.addPackage("org.libreccm.configuration") //Checked
.addPackage("org.libreccm.core") //Checked
.addPackage("org.libreccm.jpa") //Checked
.addPackage("org.libreccm.jpa.utils") //Checked
.addPackage("org.libreccm.l10n") //Checked
.addPackage("org.libreccm.modules") //Checked
.addPackage("org.libreccm.security") //Checked
.addPackage("org.libreccm.tests.categories") //Checked
.addPackage("org.libreccm.testutils") //Checked
.addPackage("org.libreccm.web") //Checked
.addPackage("org.libreccm.workflow") //Checked
.addPackage("com.arsdigita.kernel") //Checked
.addPackage("com.arsdigita.kernel.security") //Checked
.addPackage("com.arsdigita.util") //Checked
.addPackage("com.arsdigita.util.parameter") //Checked
// .addPackage(CcmCore.class.getPackage())
// .addPackage(CcmModule.class.getPackage())
// .addPackage(CcmObject.class.getPackage())
// .addPackage(CdiUtil.class.getPackage())
// .addPackage(Categorization.class.getPackage())
// .addPackage(Configuration.class.getPackage())
// .addPackage(LocalizedString.class.getPackage())
// .addPackage(CcmApplication.class.getPackage())
// .addPackage(Workflow.class.getPackage())
// .addPackage(EntityManagerProducer.class.getPackage())
// .addPackage(MimeTypeConverter.class.getPackage())
// .addPackage(EqualsVerifier.class.getPackage())
// .addPackage(IntegrationTest.class.getPackage())
// .addPackage(SecurityConfig.class.getPackage())
// .addPackage(CCMApplicationContextListener.class.getPackage())
// .addPackage(XML.class.getPackage())
// .addPackage(DateTimeFormatter.class.getPackage())
// .addPackage(AbstractParameterContext.class.getPackage())
// .addPackage(UncheckedWrapperException.class.getPackage())
// .addPackage(CCMResourceManager.class.getPackage())
// .addPackage(DispatcherHelper.class.getPackage())
// .addPackage(UI.class.getPackage())
// .addPackage(KernelConfig.class.getPackage())
// .addPackage(BasePage.class.getPackage())
.addPackage(org.libreccm.categorization.Category.class.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -121,41 +121,32 @@ public class UserManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.UserManagerTest.war")
.addPackage(User.class.getPackage())
.addPackage(CcmObject.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(SecurityConfig.class.getPackage())
.addPackage(AbstractParameterContext.class.getPackage())
.addPackage(CCMApplicationContextListener.class.getPackage())
.addPackage(XML.class.getPackage())
.addPackage(DateTimeFormatter.class.getPackage())
.addPackage(UncheckedWrapperException.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
.getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource("com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties",
"com/arsdigita/kernel/security/"
+ "SecurityConfig_parameter.properties")
.addAsWebInfResource(
"configs/org/libreccm/security/UserManagerTest/"
+ "registry.properties",
"conf/registry/registry.properties")
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource(
"configs/org/libreccm/security/UserManagerTest/ccm-core.config",
"ccm-core.config")
// .addAsWebInfResource(
// "datasets/org/libreccm//security/UserManagerTest/"
// + "security.properties",
// "conf/registry/ccm-core/security.properties")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}

View File

@ -41,3 +41,61 @@ ccm_core.users:
password: $shiro1$SHA-512$500000$RUCYXAQt+XzUmj3x8oG5gw==$qU+lX160Jc6sNUOI9X85wlf2lzn4/hLJNURtjmw9LOYJ7vAqUFFmhyNCMxpzuHIpzeMELr+A0XReoSmtcZnOOw==
password_reset_required: false
verified: true
ccm_core.ccm_objects:
- object_id: -100
display_name: registry
- object_id: -200
display_name: registry-root
- object_id: -201
display_name: com
- object_id: -202
display_name: arsdigita
- object_id: -203
display_name: kernel
- object_id: -204
display_name: KernelConfig
ccm_core.categories:
- object_id: -200
unique_id: bb93a964-bf66-424c-a22d-074d001db3b8
name: registry-root
enabled: true
visible: true
abstract_category: false
category_order: 0
- object_id: -201
unique_id: 35ac50aa-7062-47b9-808d-ac830050d373
parent_category_id: -200
name: com
enabled: true
visible: true
abstract_category: false
category_order: 1
- object_id: -202
unique_id: 28f09d9d-a7fc-4dc3-a53e-670822fa5480
parent_category_id: -201
name: arsdigita
enabled: true
visible: true
abstract_category: false
category_order: 1
- object_id: -203
unique_id: 58c0b235-8762-4ab7-9232-a5a0e39c3a01
parent_category_id: -202
name: kernel
enabled: true
visible: true
abstract_category: false
category_order: 1
- object_id: -204
unique_id: c1a45148-df0a-486f-b4f1-c5a6659081c2
parent_category_id: -203
name: KernelConfig
enabled: true
visible: true
abstract_category: false
category_order: 1
ccm_core.category_domains:
- object_id: -100
domain_key: registry
root_category_id: -200
version: 1.0

42
pom.xml
View File

@ -60,30 +60,7 @@
<module>ccm-cms-types-faqitem</module>
<module>ccm-cms-types-externallink</module>
<module>ccm-cms-types-newsitem</module>
</modules>
<pluginRepositories>
<pluginRepository>
<id>jp-digital-snapshots</id>
<url>http://archiva.jp-digital.de/repository/jp-digital-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>jp-digital-releases</id>
<url>http://archiva.jp-digital.de/repository/jp-digital-releases/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</modules>
<reporting>
<excludeDefaults>true</excludeDefaults>
@ -125,12 +102,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.4</version>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -150,11 +127,11 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.5</version>
<version>3.6</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<targetJdk>1.6</targetJdk>
<targetJdk>1.8</targetJdk>
<rulesets>
<ruleset>/rulesets/basic.xml</ruleset>
<ruleset>/rulesets/braces.xml</ruleset>
@ -186,7 +163,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.1</version>
<version>3.0.3</version>
<configuration>
<findbugsXmlOutput>true</findbugsXmlOutput>
<xmlOutput>true</xmlOutput>
@ -203,7 +180,12 @@
<plugin>
<groupId>de.jpdigital</groupId>
<artifactId>hibernate4-ddl-maven-plugin</artifactId>
<version>1.0.0-beta.2</version>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.5.201505241946</version>
</plugin>
<!--<plugin>
<groupId>org.jboss.tattletale</groupId>