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-94f89814c4dfpull/2/head
parent
53670572b2
commit
cc7889143c
|
|
@ -215,7 +215,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.3</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.8</source>
|
<source>1.8</source>
|
||||||
<target>1.8</target>
|
<target>1.8</target>
|
||||||
|
|
@ -240,7 +239,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<groups>org.libreccm.tests.categories.UnitTest</groups>
|
<groups>org.libreccm.tests.categories.UnitTest</groups>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
@ -248,7 +246,6 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
<version>0.7.5.201505241946</version>
|
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>default-prepare-agent</id>
|
<id>default-prepare-agent</id>
|
||||||
|
|
@ -383,7 +380,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-report-plugin</artifactId>
|
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
|
|
@ -393,7 +390,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>findbugs-maven-plugin</artifactId>
|
<artifactId>findbugs-maven-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
|
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
@ -401,11 +398,11 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-pmd-plugin</artifactId>
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
<version>3.4</version>
|
<version>3.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<linkXref>true</linkXref>
|
<linkXref>true</linkXref>
|
||||||
<sourceEncoding>utf-8</sourceEncoding>
|
<sourceEncoding>utf-8</sourceEncoding>
|
||||||
<targetJdk>1.7</targetJdk>
|
<targetJdk>1.8</targetJdk>
|
||||||
<rulesets>
|
<rulesets>
|
||||||
<ruleset>/rulesets/java/basic.xml</ruleset>
|
<ruleset>/rulesets/java/basic.xml</ruleset>
|
||||||
<ruleset>/rulesets/java/braces.xml</ruleset>
|
<ruleset>/rulesets/java/braces.xml</ruleset>
|
||||||
|
|
@ -458,7 +455,6 @@
|
||||||
<exclude>**/ExceptionUnwrapper.java</exclude>
|
<exclude>**/ExceptionUnwrapper.java</exclude>
|
||||||
<exclude>**/Exceptions.java</exclude>
|
<exclude>**/Exceptions.java</exclude>
|
||||||
<exclude>**/FileParameter.java</exclude>
|
<exclude>**/FileParameter.java</exclude>
|
||||||
<exclude>**/FormBuilderConfig.java</exclude>
|
|
||||||
<exclude>**/FullDateFormatter.java</exclude>
|
<exclude>**/FullDateFormatter.java</exclude>
|
||||||
<exclude>**/globalization/**</exclude>
|
<exclude>**/globalization/**</exclude>
|
||||||
<exclude>**/GlobalizationConfig.java</exclude>
|
<exclude>**/GlobalizationConfig.java</exclude>
|
||||||
|
|
@ -466,10 +462,8 @@
|
||||||
<exclude>**/JavaPropertyReader.java</exclude>
|
<exclude>**/JavaPropertyReader.java</exclude>
|
||||||
<exclude>**/JavaPropertyWriter.java</exclude>
|
<exclude>**/JavaPropertyWriter.java</exclude>
|
||||||
<exclude>**/kernel/**</exclude>
|
<exclude>**/kernel/**</exclude>
|
||||||
<exclude>**/KernelConfig.java</exclude>
|
|
||||||
<exclude>**/LockableImpl.java</exclude>
|
<exclude>**/LockableImpl.java</exclude>
|
||||||
<exclude>**/mail/**</exclude>
|
<exclude>**/mail/**</exclude>
|
||||||
<exclude>**/MailConfig.java</exclude>
|
|
||||||
<exclude>**/MapParameter.java</exclude>
|
<exclude>**/MapParameter.java</exclude>
|
||||||
<exclude>**/NotificationConfig.java</exclude>
|
<exclude>**/NotificationConfig.java</exclude>
|
||||||
<exclude>**/Parameter.java</exclude>
|
<exclude>**/Parameter.java</exclude>
|
||||||
|
|
@ -477,7 +471,6 @@
|
||||||
<exclude>**/ParameterException.java</exclude>
|
<exclude>**/ParameterException.java</exclude>
|
||||||
<exclude>**/RegistryConfig.java</exclude>
|
<exclude>**/RegistryConfig.java</exclude>
|
||||||
<exclude>**/ResourceParameter.java</exclude>
|
<exclude>**/ResourceParameter.java</exclude>
|
||||||
<exclude>**/SecurityConfig.java</exclude>
|
|
||||||
<exclude>**/SecurityHelper.java</exclude>
|
<exclude>**/SecurityHelper.java</exclude>
|
||||||
<exclude>**/SingletonParameter.java</exclude>
|
<exclude>**/SingletonParameter.java</exclude>
|
||||||
<exclude>**/SpecificClassParameter.java</exclude>
|
<exclude>**/SpecificClassParameter.java</exclude>
|
||||||
|
|
@ -514,7 +507,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
<version>2.8</version>
|
<version>2.8.1</version>
|
||||||
<reportSets>
|
<reportSets>
|
||||||
<reportSet>
|
<reportSet>
|
||||||
<reports>
|
<reports>
|
||||||
|
|
@ -542,13 +535,13 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>arquillian-tomee-embedded</artifactId>
|
<artifactId>arquillian-tomee-embedded</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>tomee-embedded</artifactId>
|
<artifactId>tomee-embedded</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.3</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|
@ -580,19 +573,19 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.logmanager</groupId>
|
<groupId>org.jboss.logmanager</groupId>
|
||||||
<artifactId>jboss-logmanager</artifactId>
|
<artifactId>jboss-logmanager</artifactId>
|
||||||
<version>1.5.4.Final</version>
|
<version>2.0.3.Final</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--Required for WebServices and RESTful WebServices-->
|
<!--Required for WebServices and RESTful WebServices-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>tomee-webservices</artifactId>
|
<artifactId>tomee-webservices</artifactId>
|
||||||
<version>1.7.1</version>
|
<version>4.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>tomee-jaxrs</artifactId>
|
<artifactId>tomee-jaxrs</artifactId>
|
||||||
<version>1.7.1</version>
|
<version>1.7.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
|
|
@ -652,7 +645,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
<forkCount>999</forkCount>
|
<forkCount>999</forkCount>
|
||||||
|
|
@ -682,12 +675,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>arquillian-tomee-remote</artifactId>
|
<artifactId>arquillian-tomee-remote</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.openejb</groupId>
|
<groupId>org.apache.openejb</groupId>
|
||||||
<artifactId>apache-tomee</artifactId>
|
<artifactId>apache-tomee</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.3</version>
|
||||||
<classifier>plus</classifier>
|
<classifier>plus</classifier>
|
||||||
<type>zip</type>
|
<type>zip</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -733,7 +726,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
<forkCount>999</forkCount>
|
<forkCount>999</forkCount>
|
||||||
|
|
@ -969,7 +962,7 @@
|
||||||
</profile>-->
|
</profile>-->
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>wildfly8-remote-h2-mem</id>
|
<id>wildfly-remote-h2-mem</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly</groupId>
|
||||||
|
|
@ -1030,7 +1023,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
<forkCount>999</forkCount>
|
<forkCount>999</forkCount>
|
||||||
|
|
@ -1052,7 +1045,7 @@
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>wildfly8-remote-pgsql</id>
|
<id>wildfly-remote-pgsql</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly</groupId>
|
||||||
|
|
@ -1113,7 +1106,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
<forkCount>999</forkCount>
|
<forkCount>999</forkCount>
|
||||||
|
|
@ -1135,7 +1128,7 @@
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>wildfly8-remote-mysql</id>
|
<id>wildfly-remote-mysql</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.wildfly</groupId>
|
<groupId>org.wildfly</groupId>
|
||||||
|
|
@ -1196,7 +1189,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<forkMode>always</forkMode>
|
<forkMode>always</forkMode>
|
||||||
<forkCount>999</forkCount>
|
<forkCount>999</forkCount>
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ public final class FormBuilderConfig {
|
||||||
private String controlsHelpUrl;
|
private String controlsHelpUrl;
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
|
@SuppressWarnings("PMD.LongVariable")
|
||||||
private Boolean interpolateEmailActions;
|
private Boolean interpolateEmailActions;
|
||||||
|
|
||||||
public static FormBuilderConfig getConfig() {
|
public static FormBuilderConfig getConfig() {
|
||||||
|
|
@ -68,6 +69,7 @@ public final class FormBuilderConfig {
|
||||||
return interpolateEmailActions;
|
return interpolateEmailActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("PMD.LongVariable")
|
||||||
public void setInterpolateEmailActions(final Boolean interpolateEmailActions) {
|
public void setInterpolateEmailActions(final Boolean interpolateEmailActions) {
|
||||||
this.interpolateEmailActions = interpolateEmailActions;
|
this.interpolateEmailActions = interpolateEmailActions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -255,6 +255,13 @@ public final class KernelConfig {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
final String languages;
|
||||||
|
if (supportedLanguages == null) {
|
||||||
|
languages = "";
|
||||||
|
} else {
|
||||||
|
languages = supportedLanguages.stream().collect(Collectors.joining(", "));
|
||||||
|
}
|
||||||
|
|
||||||
return String.format(
|
return String.format(
|
||||||
"%s{ "
|
"%s{ "
|
||||||
+ "debugEnabled = %b, "
|
+ "debugEnabled = %b, "
|
||||||
|
|
@ -275,7 +282,8 @@ public final class KernelConfig {
|
||||||
ssoEnabled,
|
ssoEnabled,
|
||||||
rememberLoginEnabled,
|
rememberLoginEnabled,
|
||||||
secureLoginEnabled,
|
secureLoginEnabled,
|
||||||
supportedLanguages.stream().collect(Collectors.joining(", ")),
|
//supportedLanguages == null ? "" : supportedLanguages.stream().collect(Collectors.joining(", ")),
|
||||||
|
languages,
|
||||||
defaultLanguage);
|
defaultLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,7 @@ public final class XmlConfig {
|
||||||
private String saxParser = "xerces";
|
private String saxParser = "xerces";
|
||||||
|
|
||||||
@Setting
|
@Setting
|
||||||
|
@SuppressWarnings("PMD.LongVariable")
|
||||||
private Boolean fullTimeFormatterEnabled = false;
|
private Boolean fullTimeFormatterEnabled = false;
|
||||||
|
|
||||||
public static XmlConfig getConfig() {
|
public static XmlConfig getConfig() {
|
||||||
|
|
@ -100,11 +101,11 @@ public final class XmlConfig {
|
||||||
* Returns the class name of the default {@link TransformerFactory}. This
|
* Returns the class name of the default {@link TransformerFactory}. This
|
||||||
* method encapsulates the default value so that is easy to change. The
|
* 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}
|
* 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
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getDefaultXslTransformerFactoryClassname() {
|
String getDefaultXslTransformerFactoryClassname() {
|
||||||
return SAXON;
|
return SAXON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,11 +128,10 @@ public final class XmlConfig {
|
||||||
*/
|
*/
|
||||||
public String getDomBuilderFactoryClassname() {
|
public String getDomBuilderFactoryClassname() {
|
||||||
|
|
||||||
switch(domBuilder) {
|
if ("resin".equals(domBuilder)) {
|
||||||
case "resin":
|
|
||||||
return DOM_RESIN;
|
return DOM_RESIN;
|
||||||
default:
|
} else {
|
||||||
return getDefaultDomBuilderFactoryClassname();
|
return getDefaultDomBuilderFactoryClassname();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,11 +139,11 @@ public final class XmlConfig {
|
||||||
* Returns the class name of the default {@link DocumentBuilderFactory}.
|
* 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
|
* 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
|
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
|
||||||
* {@code protected}.
|
* only accessible from the package.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getDefaultDomBuilderFactoryClassname() {
|
String getDefaultDomBuilderFactoryClassname() {
|
||||||
return DOM_XERCES;
|
return DOM_XERCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -167,23 +167,22 @@ public final class XmlConfig {
|
||||||
*/
|
*/
|
||||||
public String getSaxParserFactoryClassname() {
|
public String getSaxParserFactoryClassname() {
|
||||||
|
|
||||||
switch(saxParser) {
|
if ("resin".equals(saxParser)) {
|
||||||
case "resin":
|
return SAX_RESIN;
|
||||||
return SAX_RESIN;
|
} else {
|
||||||
default:
|
return getDefaultSaxParserFactoryClassname();
|
||||||
return getDefaultSaxParserFactoryClassname();
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the class name of the default {@link SAXParserFactory}.
|
* 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
|
* 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
|
* use by the classes in the {@code com.arsdigita.xml} package, therefore the method is
|
||||||
* {@code protected}.
|
* only visible in the package.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected String getDefaultSaxParserFactoryClassname() {
|
String getDefaultSaxParserFactoryClassname() {
|
||||||
return SAX_XERCES;
|
return SAX_XERCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,6 +195,7 @@ public final class XmlConfig {
|
||||||
return fullTimeFormatterEnabled;
|
return fullTimeFormatterEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("PMD.LongVariable")
|
||||||
public void setFullTimeFormatterEnabled(
|
public void setFullTimeFormatterEnabled(
|
||||||
final Boolean fullTimeFormatterEnabled) {
|
final Boolean fullTimeFormatterEnabled) {
|
||||||
this.fullTimeFormatterEnabled = fullTimeFormatterEnabled;
|
this.fullTimeFormatterEnabled = fullTimeFormatterEnabled;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ import javax.persistence.TypedQuery;
|
||||||
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
|
public class CategoryRepository extends AbstractEntityRepository<Long, Category> {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
CategoryRepository.class);
|
CategoryRepository.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private DomainRepository domainRepo;
|
private DomainRepository domainRepo;
|
||||||
|
|
@ -62,7 +62,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
*/
|
*/
|
||||||
public List<Category> getTopLevelCategories() {
|
public List<Category> getTopLevelCategories() {
|
||||||
final TypedQuery<Category> query = getEntityManager().createNamedQuery(
|
final TypedQuery<Category> query = getEntityManager().createNamedQuery(
|
||||||
"Category.topLevelCategories", Category.class);
|
"Category.topLevelCategories", Category.class);
|
||||||
|
|
||||||
return query.getResultList();
|
return query.getResultList();
|
||||||
}
|
}
|
||||||
|
|
@ -75,14 +75,14 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
final String[] tokens = path.split(":");
|
final String[] tokens = path.split(":");
|
||||||
if (tokens.length > 2) {
|
if (tokens.length > 2) {
|
||||||
throw new InvalidCategoryPathException(
|
throw new InvalidCategoryPathException(
|
||||||
"The provided path is invalid: More than one colon found. "
|
"The provided path is invalid: More than one colon found. "
|
||||||
+ "Valid path format: domainKey:path");
|
+ "Valid path format: domainKey:path");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tokens.length < 2) {
|
if (tokens.length < 2) {
|
||||||
throw new InvalidCategoryPathException(
|
throw new InvalidCategoryPathException(
|
||||||
"The provided path is invalid: No domain found in path. "
|
"The provided path is invalid: No domain found in path. "
|
||||||
+ "Valid path format: domainKey:path");
|
+ "Valid path format: domainKey:path");
|
||||||
}
|
}
|
||||||
|
|
||||||
final Domain domain;
|
final Domain domain;
|
||||||
|
|
@ -90,8 +90,8 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
domain = domainRepo.findByDomainKey(tokens[0]);
|
domain = domainRepo.findByDomainKey(tokens[0]);
|
||||||
} catch (NoResultException ex) {
|
} catch (NoResultException ex) {
|
||||||
throw new InvalidCategoryPathException(String.format(
|
throw new InvalidCategoryPathException(String.format(
|
||||||
"No domain identified by the key '%s' found.",
|
"No domain identified by the key '%s' found.",
|
||||||
tokens[0]),
|
tokens[0]),
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -108,7 +108,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
}
|
}
|
||||||
|
|
||||||
String normalizedPath = path.replace('.', '/');
|
String normalizedPath = path.replace('.', '/');
|
||||||
if (normalizedPath.startsWith("/")) {
|
if (normalizedPath.charAt(0) == '/') {
|
||||||
normalizedPath = normalizedPath.substring(1);
|
normalizedPath = normalizedPath.substring(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,28 +118,29 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug(String.format(
|
LOGGER.debug(String.format(
|
||||||
"Trying to find category with path \"%s\" in "
|
"Trying to find category with path \"%s\" in "
|
||||||
+ "domain \"%s\".",
|
+ "domain \"%s\".",
|
||||||
normalizedPath,
|
normalizedPath,
|
||||||
domain.getDomainKey()));
|
domain.getDomainKey()));
|
||||||
final String[] tokens = normalizedPath.split("/");
|
final String[] tokens = normalizedPath.split("/");
|
||||||
Category current = domain.getRoot();
|
Category current = domain.getRoot();
|
||||||
for (String token : tokens) {
|
for (final String token : tokens) {
|
||||||
if (current.getSubCategories() == null) {
|
if (current.getSubCategories() == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final Optional<Category> result = current.getSubCategories()
|
final Optional<Category> result = current.getSubCategories()
|
||||||
.stream()
|
.stream()
|
||||||
.filter((c) -> {
|
.filter((c) -> {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findByPath(Domain, String): c = {}",
|
||||||
"#findByPath(Domain, String): c = %s", c.toString()));
|
c.toString());
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug(
|
||||||
"#findByPath(Domain, String): c.getName = \"%s\"", c.getName()));
|
"#findByPath(Domain, String): c.getName = \"{}\"",
|
||||||
LOGGER.debug(new FormattedMessage(
|
c.getName());
|
||||||
"#findByPath(Domain, String): token = \"%s\"", token));
|
LOGGER.debug("#findByPath(Domain, String): token = \"{}\"",
|
||||||
return c.getName().equals(token);
|
token);
|
||||||
})
|
return c.getName().equals(token);
|
||||||
.findFirst();
|
})
|
||||||
|
.findFirst();
|
||||||
if (result.isPresent()) {
|
if (result.isPresent()) {
|
||||||
current = result.get();
|
current = result.get();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -155,7 +156,7 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
* subcategory or the an {@link Domain} as root category.
|
* subcategory or the an {@link Domain} as root category.
|
||||||
*
|
*
|
||||||
* @return A list of all orphaned categories. Normally this list should be
|
* @return A list of all orphaned categories. Normally this list should be
|
||||||
* empty.
|
* empty.
|
||||||
*/
|
*/
|
||||||
public List<Category> getOrphanedCategories() {
|
public List<Category> getOrphanedCategories() {
|
||||||
// TODO implement method
|
// TODO implement method
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,11 @@ 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>
|
||||||
*/
|
*/
|
||||||
@RequestScoped
|
@RequestScoped
|
||||||
|
@SuppressWarnings({"PMD.GodClass",
|
||||||
|
"PMD.TooManyMethods",
|
||||||
|
"PMD.LongVariable",
|
||||||
|
"PMD.ModifiedCyclomaticComplexity",
|
||||||
|
"PMD.StandardCyclomaticComplexity",})
|
||||||
public class ConfigurationManager {
|
public class ConfigurationManager {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
|
|
@ -307,6 +312,9 @@ public class ConfigurationManager {
|
||||||
*
|
*
|
||||||
* @return The {@link SettingInfo} for the provided configuration class.
|
* @return The {@link SettingInfo} for the provided configuration class.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings({"PMD.NPathComplexity",
|
||||||
|
"PMD.CyclomaticComplexity",
|
||||||
|
"PMD.StandardCyclomaticComplexity"})
|
||||||
public SettingInfo getSettingInfo(final Class<?> configuration,
|
public SettingInfo getSettingInfo(final Class<?> configuration,
|
||||||
final String name) {
|
final String name) {
|
||||||
if (configuration == null) {
|
if (configuration == null) {
|
||||||
|
|
@ -374,18 +382,18 @@ public class ConfigurationManager {
|
||||||
settingInfo.setConfClass(configuration.getName());
|
settingInfo.setConfClass(configuration.getName());
|
||||||
|
|
||||||
settingInfo.setDescBundle(descBundle);
|
settingInfo.setDescBundle(descBundle);
|
||||||
|
|
||||||
if (settingAnnotation.labelKey() == null
|
if (settingAnnotation.labelKey() == null
|
||||||
|| settingAnnotation.labelKey().isEmpty()) {
|
|| settingAnnotation.labelKey().isEmpty()) {
|
||||||
settingInfo.setLabelKey(String.join(".", field.getName(),
|
settingInfo.setLabelKey(String.join(".", field.getName(),
|
||||||
"label"));
|
"label"));
|
||||||
} else {
|
} else {
|
||||||
settingInfo.setLabelKey(name);
|
settingInfo.setLabelKey(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (settingAnnotation.descKey() == null
|
if (settingAnnotation.descKey() == null
|
||||||
|| settingAnnotation.descKey().isEmpty()) {
|
|| settingAnnotation.descKey().isEmpty()) {
|
||||||
settingInfo.setDescKey(String.join(".",
|
settingInfo.setDescKey(String.join(".",
|
||||||
field.getName(),
|
field.getName(),
|
||||||
"descripotion"));
|
"descripotion"));
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -578,25 +586,6 @@ public class ConfigurationManager {
|
||||||
setting.setDisplayName(settingName);
|
setting.setDisplayName(settingName);
|
||||||
final Category category = findCategoryForNewSetting(configuration);
|
final Category category = findCategoryForNewSetting(configuration);
|
||||||
categoryManager.addObjectToCategory(setting, category);
|
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\"",
|
LOGGER.debug(String.format("New value of setting \"%s\" is: \"%s\"",
|
||||||
|
|
@ -685,7 +674,7 @@ public class ConfigurationManager {
|
||||||
ex);
|
ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
@ -705,17 +694,16 @@ public class ConfigurationManager {
|
||||||
settingType);
|
settingType);
|
||||||
if (setting != null) {
|
if (setting != null) {
|
||||||
try {
|
try {
|
||||||
LOGGER.debug(String.
|
LOGGER.debug("Setting \"{}\" found. Value: %s",
|
||||||
format("Setting \"%s\" found. Value: %s",
|
settingPath,
|
||||||
settingPath,
|
setting.getValue().toString());
|
||||||
setting.getValue().toString()));
|
|
||||||
field.set(conf, setting.getValue());
|
field.set(conf, setting.getValue());
|
||||||
} catch (IllegalAccessException ex) {
|
} catch (IllegalAccessException ex) {
|
||||||
LOGGER.warn(String.format(
|
LOGGER.warn(
|
||||||
"Failed to set value of configuration class \"%s\". "
|
"Failed to set value of configuration class \"{}\". "
|
||||||
+ "Ignoring.",
|
+ "Ignoring.",
|
||||||
confClass.getName()),
|
confClass.getName(),
|
||||||
ex);
|
ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -724,10 +712,9 @@ public class ConfigurationManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Category findCategoryForNewSetting(final Object configuration) {
|
private Category findCategoryForNewSetting(final Object configuration) {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: Looking for category for "
|
||||||
"#findCategoryForNewSetting: Looking for category for "
|
+ "configuration \"{}\"...",
|
||||||
+ "configuration \"%s\"...",
|
configuration.getClass().getName());
|
||||||
configuration.getClass().getName()));
|
|
||||||
final String categoryPath = configuration.getClass().getName();
|
final String categoryPath = configuration.getClass().getName();
|
||||||
final String[] tokens = categoryPath.split("\\.");
|
final String[] tokens = categoryPath.split("\\.");
|
||||||
final Domain registry = domainRepository
|
final Domain registry = domainRepository
|
||||||
|
|
@ -739,20 +726,20 @@ public class ConfigurationManager {
|
||||||
final boolean[] exists = new boolean[tokens.length];
|
final boolean[] exists = new boolean[tokens.length];
|
||||||
for (int i = 0; i < tokens.length; i++) {
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
final String path = buildCategoryPath(tokens, i);
|
final String path = buildCategoryPath(tokens, i);
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: "
|
||||||
"#findCategoryForNewSetting: Checking if category \"%s\" exists.",
|
+ "Checking if category \"{}\" exists.",
|
||||||
path));
|
path);
|
||||||
final Category category = categoryRepository.findByPath(registry,
|
final Category category = categoryRepository.findByPath(registry,
|
||||||
path);
|
path);
|
||||||
if (category == null) {
|
if (category == null) {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: "
|
||||||
"#findCategoryForNewSetting: Category \"%s\" does not exist.",
|
+ "Category \"{}\" does not exist.",
|
||||||
path));
|
path);
|
||||||
exists[i] = false;
|
exists[i] = false;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug(
|
||||||
"#findCategoryForNewSetting: Category \"%s\" exists.",
|
"#findCategoryForNewSetting: Category \"{}\" exists.",
|
||||||
path));
|
path);
|
||||||
exists[i] = true;
|
exists[i] = true;
|
||||||
categories[i] = category;
|
categories[i] = category;
|
||||||
}
|
}
|
||||||
|
|
@ -761,33 +748,34 @@ public class ConfigurationManager {
|
||||||
LOGGER.debug(
|
LOGGER.debug(
|
||||||
"#findCategoryForNewSetting: Creating missing categories...");
|
"#findCategoryForNewSetting: Creating missing categories...");
|
||||||
for (int i = 0; i < tokens.length; i++) {
|
for (int i = 0; i < tokens.length; i++) {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug(
|
||||||
"#findCategoryForNewSetting: Checking for category \"%s\"...",
|
"#findCategoryForNewSetting: Checking for category \"{}\"...",
|
||||||
tokens[i]));
|
tokens[i]);
|
||||||
if (!exists[i]) {
|
if (!exists[i]) {
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: "
|
||||||
"#findCategoryForNewSetting: Category \"%s\" does not exist, "
|
+ "Category \"{}\" does not exist, "
|
||||||
+ "creating as subcategory of the registry root category.",
|
+ "creating as subcategory of the registry "
|
||||||
tokens[i]));
|
+ "root category.",
|
||||||
|
tokens[i]);
|
||||||
categories[i] = createNewCategory(tokens[i],
|
categories[i] = createNewCategory(tokens[i],
|
||||||
registry.getRoot());
|
registry.getRoot());
|
||||||
} else {
|
} else {
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: "
|
||||||
"#findCategoryForNewSetting: Category \"%s\" does not exist, "
|
+ "Category \"{}\" does not exist, "
|
||||||
+ "creating as subcategory of \"%s\"",
|
+ "creating as subcategory of \"{}\"",
|
||||||
tokens[i],
|
tokens[i],
|
||||||
categories[i - 1].getName()));
|
categories[i - 1].getName());
|
||||||
categories[i] = createNewCategory(tokens[i],
|
categories[i] = createNewCategory(tokens[i],
|
||||||
categories[i - 1]);
|
categories[i - 1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.debug(new FormattedMessage(
|
LOGGER.debug("#findCategoryForNewSetting: "
|
||||||
"#findCategoryForNewSetting: Found/Created category \"%s\".",
|
+ "Found/Created category \"{}\".",
|
||||||
categoryPath));
|
categoryPath);
|
||||||
return categories[categories.length - 1];
|
return categories[categories.length - 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,16 +155,40 @@ public final class SettingInfo {
|
||||||
if (!Objects.equals(name, other.getName())) {
|
if (!Objects.equals(name, other.getName())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(valueType, other.getValueType())) {
|
// if (!Objects.equals(valueType, other.getValueType())) {
|
||||||
return false;
|
// return false;
|
||||||
}
|
// }
|
||||||
if (!Objects.equals(defaultValue, other.getDefaultValue())) {
|
// if (!Objects.equals(defaultValue, other.getDefaultValue())) {
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
if (!equalsValueProps(other)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!Objects.equals(confClass, other.getConfClass())) {
|
if (!Objects.equals(confClass, other.getConfClass())) {
|
||||||
return false;
|
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())) {
|
if (!Objects.equals(descBundle, other.getDescBundle())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class StringListSetting extends AbstractSetting<List<String>> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(final Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -53,7 +53,11 @@ import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
|
||||||
|
import org.libreccm.categorization.Category;
|
||||||
|
|
||||||
|
import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.*;
|
import static org.hamcrest.Matchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -192,7 +196,9 @@ public class ConfigurationManagerTest {
|
||||||
final TestConfiguration configuration = configurationManager
|
final TestConfiguration configuration = configurationManager
|
||||||
.findConfiguration(TestConfiguration.class);
|
.findConfiguration(TestConfiguration.class);
|
||||||
|
|
||||||
assertThat(configuration, is(nullValue()));
|
assertThat(configuration, is(not(nullValue())));
|
||||||
|
assertThat(configuration.getEnabled(), is(false));
|
||||||
|
assertThat(configuration.getItemsPerPage(), is(40L));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,9 @@ public class AuthorizationInterceptorTest {
|
||||||
.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())
|
||||||
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.configuration.ConfigurationManager.class
|
.addPackage(org.libreccm.configuration.ConfigurationManager.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.getPackage())
|
.getPackage())
|
||||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
.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.User.class.getPackage())
|
||||||
.addPackage(org.libreccm.security.authorization.LabBean.class
|
.addPackage(org.libreccm.security.authorization.LabBean.class
|
||||||
.getPackage())
|
.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.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||||
|
|
|
||||||
|
|
@ -120,36 +120,27 @@ public class GroupManagerTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.GroupManagerTest.war")
|
"LibreCCM-org.libreccm.security.GroupManagerTest.war")
|
||||||
.addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
.getPackage())
|
||||||
|
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
|
||||||
|
.getPackage())
|
||||||
.addAsLibraries(libs)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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")
|
.addAsWebInfResource("test-web.xml", "web.xml")
|
||||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
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 static org.libreccm.core.CoreConstants.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
@ -56,19 +49,10 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
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.CcmObject;
|
||||||
import org.libreccm.core.CcmObjectRepository;
|
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.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.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -85,38 +69,38 @@ import static org.junit.Assert.*;
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_core_schema.sql"})
|
@CreateSchema({"create_ccm_core_schema.sql"})
|
||||||
public class PermissionCheckerTest {
|
public class PermissionCheckerTest {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Subject subject;
|
private Subject subject;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Shiro shiro;
|
private Shiro shiro;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PermissionChecker permissionChecker;
|
private PermissionChecker permissionChecker;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private CcmObjectRepository objectRepository;
|
private CcmObjectRepository objectRepository;
|
||||||
|
|
||||||
public PermissionCheckerTest() {
|
public PermissionCheckerTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpClass() {
|
public static void setUpClass() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void tearDownClass() {
|
public static void tearDownClass() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
public void tearDown() {
|
public void tearDown() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deployment
|
@Deployment
|
||||||
public static WebArchive createDeployment() {
|
public static WebArchive createDeployment() {
|
||||||
final PomEquippedResolveStage pom = Maven
|
final PomEquippedResolveStage pom = Maven
|
||||||
|
|
@ -125,66 +109,49 @@ public class PermissionCheckerTest {
|
||||||
final PomEquippedResolveStage dependencies = pom.
|
final PomEquippedResolveStage dependencies = pom.
|
||||||
importCompileAndRuntimeDependencies();
|
importCompileAndRuntimeDependencies();
|
||||||
final File[] libs = dependencies.resolve().withTransitivity().asFile();
|
final File[] libs = dependencies.resolve().withTransitivity().asFile();
|
||||||
|
|
||||||
for (File lib : libs) {
|
for (File lib : libs) {
|
||||||
System.err.printf("Adding file '%s' to test archive...%n",
|
System.err.printf("Adding file '%s' to test archive...%n",
|
||||||
lib.getName());
|
lib.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.PermissionCheckerTest.war").
|
"LibreCCM-org.libreccm.security.PermissionCheckerTest.war")
|
||||||
addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.configuration.ConfigurationManager.class
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(XML.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(CdiUtil.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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/shiro.ini", "shiro.ini")
|
||||||
.addAsResource(
|
.addAsResource(
|
||||||
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
||||||
"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("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(1100)
|
@InSequence(1100)
|
||||||
|
|
@ -193,12 +160,12 @@ public class PermissionCheckerTest {
|
||||||
"foo123");
|
"foo123");
|
||||||
token.setRememberMe(true);
|
token.setRememberMe(true);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
|
||||||
assertThat(permissionChecker.isPermitted("privilege1"), is(false));
|
assertThat(permissionChecker.isPermitted("privilege1"), is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
|
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
|
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(1200)
|
@InSequence(1200)
|
||||||
|
|
@ -207,7 +174,7 @@ public class PermissionCheckerTest {
|
||||||
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
|
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
|
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(1300)
|
@InSequence(1300)
|
||||||
|
|
@ -215,9 +182,9 @@ public class PermissionCheckerTest {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
final CcmObject object3 = objectRepository.findById(-20003L);
|
final CcmObject object3 = objectRepository.findById(-20003L);
|
||||||
|
|
||||||
shiro.getSystemUser().execute(new Callable<Boolean>() {
|
shiro.getSystemUser().execute(new Callable<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean call() {
|
public Boolean call() {
|
||||||
assertThat(permissionChecker.isPermitted("privilege1"),
|
assertThat(permissionChecker.isPermitted("privilege1"),
|
||||||
|
|
@ -226,7 +193,7 @@ public class PermissionCheckerTest {
|
||||||
is(true));
|
is(true));
|
||||||
assertThat(permissionChecker.isPermitted("privilege3"),
|
assertThat(permissionChecker.isPermitted("privilege3"),
|
||||||
is(true));
|
is(true));
|
||||||
|
|
||||||
assertThat(permissionChecker.isPermitted("privilege1",
|
assertThat(permissionChecker.isPermitted("privilege1",
|
||||||
object2),
|
object2),
|
||||||
is(true));
|
is(true));
|
||||||
|
|
@ -236,42 +203,42 @@ public class PermissionCheckerTest {
|
||||||
assertThat(permissionChecker.isPermitted("privilege3",
|
assertThat(permissionChecker.isPermitted("privilege3",
|
||||||
object3),
|
object3),
|
||||||
is(true));
|
is(true));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(1400)
|
@InSequence(1400)
|
||||||
public void isPermittedObjectAuthenticatedUser() {
|
public void isPermittedObjectAuthenticatedUser() {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
||||||
"foo123");
|
"foo123");
|
||||||
token.setRememberMe(true);
|
token.setRememberMe(true);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
|
||||||
assertThat(permissionChecker.isPermitted("privilege1", object1),
|
assertThat(permissionChecker.isPermitted("privilege1", object1),
|
||||||
is(false));
|
is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege2", object1),
|
assertThat(permissionChecker.isPermitted("privilege2", object1),
|
||||||
is(false));
|
is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege2", object2),
|
assertThat(permissionChecker.isPermitted("privilege2", object2),
|
||||||
is(true));
|
is(true));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(1500)
|
@InSequence(1500)
|
||||||
public void isPermittedObjectUnAuthenticatedUser() {
|
public void isPermittedObjectUnAuthenticatedUser() {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
assertThat(permissionChecker.isPermitted("privilege1", object1),
|
assertThat(permissionChecker.isPermitted("privilege1", object1),
|
||||||
is(false));
|
is(false));
|
||||||
assertThat(permissionChecker.isPermitted("privilege2", object1),
|
assertThat(permissionChecker.isPermitted("privilege2", object1),
|
||||||
|
|
@ -281,7 +248,7 @@ public class PermissionCheckerTest {
|
||||||
assertThat(permissionChecker.isPermitted("privilege3", object1),
|
assertThat(permissionChecker.isPermitted("privilege3", object1),
|
||||||
is(true));
|
is(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(2100)
|
@InSequence(2100)
|
||||||
|
|
@ -290,10 +257,10 @@ public class PermissionCheckerTest {
|
||||||
"foo123");
|
"foo123");
|
||||||
token.setRememberMe(true);
|
token.setRememberMe(true);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
|
||||||
permissionChecker.checkPermission("privilege1");
|
permissionChecker.checkPermission("privilege1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = AuthorizationException.class)
|
@Test(expected = AuthorizationException.class)
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@ShouldThrowException(AuthorizationException.class)
|
@ShouldThrowException(AuthorizationException.class)
|
||||||
|
|
@ -301,40 +268,40 @@ public class PermissionCheckerTest {
|
||||||
public void checkPermissionUnAuthenticatedUser() {
|
public void checkPermissionUnAuthenticatedUser() {
|
||||||
permissionChecker.checkPermission("privilege1");
|
permissionChecker.checkPermission("privilege1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(2300)
|
@InSequence(2300)
|
||||||
public void checkPermissionObjectAuthenticatedUser() {
|
public void checkPermissionObjectAuthenticatedUser() {
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
||||||
"foo123");
|
"foo123");
|
||||||
token.setRememberMe(true);
|
token.setRememberMe(true);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
|
||||||
permissionChecker.checkPermission("privilege2", object2);
|
permissionChecker.checkPermission("privilege2", object2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = AuthorizationException.class)
|
@Test(expected = AuthorizationException.class)
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@ShouldThrowException(AuthorizationException.class)
|
@ShouldThrowException(AuthorizationException.class)
|
||||||
@InSequence(2400)
|
@InSequence(2400)
|
||||||
public void checkPermissionObjectUnAuthenticatedUser() {
|
public void checkPermissionObjectUnAuthenticatedUser() {
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
permissionChecker.checkPermission("privilege2", object2);
|
permissionChecker.checkPermission("privilege2", object2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(2500)
|
@InSequence(2500)
|
||||||
public void checkPermissionObjectPublicUser() {
|
public void checkPermissionObjectPublicUser() {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
|
|
||||||
permissionChecker.checkPermission("privilege3", object1);
|
permissionChecker.checkPermission("privilege3", object1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(2600)
|
@InSequence(2600)
|
||||||
|
|
@ -342,69 +309,69 @@ public class PermissionCheckerTest {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
final CcmObject object3 = objectRepository.findById(-20003L);
|
final CcmObject object3 = objectRepository.findById(-20003L);
|
||||||
|
|
||||||
shiro.getSystemUser().execute(new Callable<Boolean>() {
|
shiro.getSystemUser().execute(new Callable<Boolean>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean call() {
|
public Boolean call() {
|
||||||
permissionChecker.checkPermission("privilege1");
|
permissionChecker.checkPermission("privilege1");
|
||||||
permissionChecker.checkPermission("privilege2");
|
permissionChecker.checkPermission("privilege2");
|
||||||
permissionChecker.checkPermission("privilege3");
|
permissionChecker.checkPermission("privilege3");
|
||||||
|
|
||||||
permissionChecker.checkPermission("privilege1", object3);
|
permissionChecker.checkPermission("privilege1", object3);
|
||||||
permissionChecker.checkPermission("privilege2", object1);
|
permissionChecker.checkPermission("privilege2", object1);
|
||||||
permissionChecker.checkPermission("privilege3", object2);
|
permissionChecker.checkPermission("privilege3", object2);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(3100)
|
@InSequence(3100)
|
||||||
public void checkPermissionReturnObjectAuthenticatedUser() {
|
public void checkPermissionReturnObjectAuthenticatedUser() {
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
|
||||||
"foo123");
|
"foo123");
|
||||||
token.setRememberMe(true);
|
token.setRememberMe(true);
|
||||||
subject.login(token);
|
subject.login(token);
|
||||||
|
|
||||||
final CcmObject result = permissionChecker.checkPermission(
|
final CcmObject result = permissionChecker.checkPermission(
|
||||||
"privilege2", object2, CcmObject.class);
|
"privilege2", object2, CcmObject.class);
|
||||||
assertThat(result.getDisplayName(), is(equalTo("object2")));
|
assertThat(result.getDisplayName(), is(equalTo("object2")));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
|
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
|
||||||
assertThat(result, is(equalTo(object2)));
|
assertThat(result, is(equalTo(object2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(3200)
|
@InSequence(3200)
|
||||||
public void checkPermissionReturnObjectUnAuthenticatedUser() {
|
public void checkPermissionReturnObjectUnAuthenticatedUser() {
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
|
|
||||||
final CcmObject result = permissionChecker.checkPermission(
|
final CcmObject result = permissionChecker.checkPermission(
|
||||||
"privilege2", object2, CcmObject.class);
|
"privilege2", object2, CcmObject.class);
|
||||||
assertThat(result.getDisplayName(), is(equalTo(ACCESS_DENIED)));
|
assertThat(result.getDisplayName(), is(equalTo(ACCESS_DENIED)));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result), is(true));
|
assertThat(permissionChecker.isAccessDeniedObject(result), is(true));
|
||||||
assertThat(result, is(not(equalTo(object2))));
|
assertThat(result, is(not(equalTo(object2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(600)
|
@InSequence(600)
|
||||||
public void checkPermissionReturnObjectPublicUser() {
|
public void checkPermissionReturnObjectPublicUser() {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
|
|
||||||
final CcmObject result = permissionChecker.checkPermission(
|
final CcmObject result = permissionChecker.checkPermission(
|
||||||
"privilege3", object1, CcmObject.class);
|
"privilege3", object1, CcmObject.class);
|
||||||
assertThat(result.getDisplayName(), is(equalTo("object1")));
|
assertThat(result.getDisplayName(), is(equalTo("object1")));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
|
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
|
||||||
assertThat(result, is(equalTo(object1)));
|
assertThat(result, is(equalTo(object1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
|
||||||
@InSequence(3200)
|
@InSequence(3200)
|
||||||
|
|
@ -412,48 +379,48 @@ public class PermissionCheckerTest {
|
||||||
final CcmObject object1 = objectRepository.findById(-20001L);
|
final CcmObject object1 = objectRepository.findById(-20001L);
|
||||||
final CcmObject object2 = objectRepository.findById(-20002L);
|
final CcmObject object2 = objectRepository.findById(-20002L);
|
||||||
final CcmObject object3 = objectRepository.findById(-20003L);
|
final CcmObject object3 = objectRepository.findById(-20003L);
|
||||||
|
|
||||||
final List<CcmObject> results = shiro.getSystemUser().execute(
|
final List<CcmObject> results = shiro.getSystemUser().execute(
|
||||||
new Callable<List<CcmObject>>() {
|
new Callable<List<CcmObject>>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CcmObject> call() {
|
public List<CcmObject> call() {
|
||||||
permissionChecker.checkPermission("privilege1");
|
permissionChecker.checkPermission("privilege1");
|
||||||
permissionChecker.checkPermission("privilege2");
|
permissionChecker.checkPermission("privilege2");
|
||||||
permissionChecker.checkPermission("privilege3");
|
permissionChecker.checkPermission("privilege3");
|
||||||
|
|
||||||
final CcmObject result3 = permissionChecker.checkPermission(
|
final CcmObject result3 = permissionChecker.checkPermission(
|
||||||
"privilege1", object3, CcmObject.class);
|
"privilege1", object3, CcmObject.class);
|
||||||
final CcmObject result1 = permissionChecker.checkPermission(
|
final CcmObject result1 = permissionChecker.checkPermission(
|
||||||
"privilege2", object1, CcmObject.class);
|
"privilege2", object1, CcmObject.class);
|
||||||
final CcmObject result2 = permissionChecker.checkPermission(
|
final CcmObject result2 = permissionChecker.checkPermission(
|
||||||
"privilege3", object2, CcmObject.class);
|
"privilege3", object2, CcmObject.class);
|
||||||
|
|
||||||
final List<CcmObject> results = new ArrayList<>();
|
final List<CcmObject> results = new ArrayList<>();
|
||||||
results.add(result1);
|
results.add(result1);
|
||||||
results.add(result2);
|
results.add(result2);
|
||||||
results.add(result3);
|
results.add(result3);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final CcmObject result1 = results.get(0);
|
final CcmObject result1 = results.get(0);
|
||||||
final CcmObject result2 = results.get(1);
|
final CcmObject result2 = results.get(1);
|
||||||
final CcmObject result3 = results.get(2);
|
final CcmObject result3 = results.get(2);
|
||||||
|
|
||||||
assertThat(result1.getDisplayName(), is(equalTo("object1")));
|
assertThat(result1.getDisplayName(), is(equalTo("object1")));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result1), is(false));
|
assertThat(permissionChecker.isAccessDeniedObject(result1), is(false));
|
||||||
assertThat(result1, is(equalTo(object1)));
|
assertThat(result1, is(equalTo(object1)));
|
||||||
|
|
||||||
assertThat(result2.getDisplayName(), is(equalTo("object2")));
|
assertThat(result2.getDisplayName(), is(equalTo("object2")));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result2), is(false));
|
assertThat(permissionChecker.isAccessDeniedObject(result2), is(false));
|
||||||
assertThat(result2, is(equalTo(object2)));
|
assertThat(result2, is(equalTo(object2)));
|
||||||
|
|
||||||
assertThat(result3.getDisplayName(), is(equalTo("object3")));
|
assertThat(result3.getDisplayName(), is(equalTo("object3")));
|
||||||
assertThat(permissionChecker.isAccessDeniedObject(result3), is(false));
|
assertThat(permissionChecker.isAccessDeniedObject(result3), is(false));
|
||||||
assertThat(result3, is(equalTo(object3)));
|
assertThat(result3, is(equalTo(object3)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
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.Deployment;
|
||||||
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
||||||
|
|
@ -47,16 +41,9 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.libreccm.categorization.Categorization;
|
|
||||||
import org.libreccm.core.CcmObject;
|
import org.libreccm.core.CcmObject;
|
||||||
import org.libreccm.core.CcmObjectRepository;
|
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.tests.categories.IntegrationTest;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
import org.libreccm.web.CcmApplication;
|
|
||||||
import org.libreccm.workflow.Workflow;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
|
@ -125,36 +112,30 @@ public class PermissionManagerTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.PermissionManagerTest.war")
|
"LibreCCM-org.libreccm.security.PermissionManagerTest.war")
|
||||||
.addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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")
|
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||||
.addAsWebInfResource("test-web.xml", "web.xml")
|
.addAsWebInfResource("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
|
|
|
||||||
|
|
@ -18,13 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
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.Deployment;
|
||||||
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
import org.jboss.arquillian.container.test.api.ShouldThrowException;
|
||||||
import org.jboss.arquillian.junit.Arquillian;
|
import org.jboss.arquillian.junit.Arquillian;
|
||||||
|
|
@ -47,15 +40,7 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
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.tests.categories.IntegrationTest;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
import org.libreccm.web.CcmApplication;
|
|
||||||
import org.libreccm.workflow.Workflow;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
|
@ -120,36 +105,30 @@ public class RoleManagerTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.RoleManagerTest.war")
|
"LibreCCM-org.libreccm.security.RoleManagerTest.war")
|
||||||
.addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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")
|
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||||
.addAsWebInfResource("test-web.xml", "web.xml")
|
.addAsWebInfResource("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
|
|
|
||||||
|
|
@ -150,54 +150,36 @@ public class SecuredCollectionTest {
|
||||||
|
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.SecuredCollectionTest.war").
|
"LibreCCM-org.libreccm.security.SecuredCollectionTest.war")
|
||||||
addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(Categorization.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage(Workflow.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(CdiUtil.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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/shiro.ini", "shiro.ini")
|
||||||
.addAsResource(
|
.addAsResource(
|
||||||
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
||||||
"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("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.security;
|
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.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
@ -47,17 +41,9 @@ import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
import org.junit.experimental.categories.Category;
|
||||||
import org.junit.runner.RunWith;
|
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.CcmObject;
|
||||||
import org.libreccm.core.CcmObjectRepository;
|
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.tests.categories.IntegrationTest;
|
||||||
import org.libreccm.testutils.EqualsVerifier;
|
|
||||||
import org.libreccm.web.CcmApplication;
|
|
||||||
import org.libreccm.workflow.Workflow;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -151,53 +137,35 @@ public class SecuredIteratorTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.SecuredIteratorTest.war")
|
"LibreCCM-org.libreccm.security.SecuredIteratorTest.war")
|
||||||
.addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(CdiUtil.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(UncheckedWrapperException.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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/shiro.ini", "shiro.ini")
|
||||||
.addAsResource(
|
.addAsResource(
|
||||||
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
"configs/org/libreccm/security/ShiroTest/log4j2.xml",
|
||||||
"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("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -105,47 +105,25 @@ public class ShiroTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.ShiroTest.war")
|
"LibreCCM-org.libreccm.security.ShiroTest.war")
|
||||||
.addPackage("org.libreccm.cdi.utils") //Checked
|
.addPackage(org.libreccm.categorization.Category.class.getPackage())
|
||||||
.addPackage("org.libreccm.categorization") //Checked
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
.addPackage("org.libreccm.configuration") //Checked
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage("org.libreccm.core") //Checked
|
.getPackage())
|
||||||
.addPackage("org.libreccm.jpa") //Checked
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage("org.libreccm.jpa.utils") //Checked
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage("org.libreccm.l10n") //Checked
|
.getPackage())
|
||||||
.addPackage("org.libreccm.modules") //Checked
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage("org.libreccm.security") //Checked
|
.getPackage())
|
||||||
.addPackage("org.libreccm.tests.categories") //Checked
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage("org.libreccm.testutils") //Checked
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage("org.libreccm.web") //Checked
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage("org.libreccm.workflow") //Checked
|
.getPackage())
|
||||||
.addPackage("com.arsdigita.kernel") //Checked
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage("com.arsdigita.kernel.security") //Checked
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage("com.arsdigita.util") //Checked
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage("com.arsdigita.util.parameter") //Checked
|
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
|
||||||
// .addPackage(CcmCore.class.getPackage())
|
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||||
// .addPackage(CcmModule.class.getPackage())
|
.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())
|
|
||||||
.addAsLibraries(libs)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/persistence.xml")
|
"META-INF/persistence.xml")
|
||||||
|
|
|
||||||
|
|
@ -121,41 +121,32 @@ public class UserManagerTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.UserManagerTest.war")
|
"LibreCCM-org.libreccm.security.UserManagerTest.war")
|
||||||
.addPackage(User.class.getPackage())
|
.addPackage(org.libreccm.categorization.Categorization.class
|
||||||
.addPackage(CcmObject.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(org.libreccm.configuration.Configuration.class
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(SecurityConfig.class.getPackage())
|
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
|
||||||
.addPackage(AbstractParameterContext.class.getPackage())
|
.addPackage(org.libreccm.security.User.class.getPackage())
|
||||||
.addPackage(CCMApplicationContextListener.class.getPackage())
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
.addPackage(XML.class.getPackage())
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
.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)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/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/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("test-web.xml", "web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,62 @@ ccm_core.users:
|
||||||
party_id: -30
|
party_id: -30
|
||||||
password: $shiro1$SHA-512$500000$RUCYXAQt+XzUmj3x8oG5gw==$qU+lX160Jc6sNUOI9X85wlf2lzn4/hLJNURtjmw9LOYJ7vAqUFFmhyNCMxpzuHIpzeMELr+A0XReoSmtcZnOOw==
|
password: $shiro1$SHA-512$500000$RUCYXAQt+XzUmj3x8oG5gw==$qU+lX160Jc6sNUOI9X85wlf2lzn4/hLJNURtjmw9LOYJ7vAqUFFmhyNCMxpzuHIpzeMELr+A0XReoSmtcZnOOw==
|
||||||
password_reset_required: false
|
password_reset_required: false
|
||||||
verified: true
|
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
42
pom.xml
|
|
@ -60,30 +60,7 @@
|
||||||
<module>ccm-cms-types-faqitem</module>
|
<module>ccm-cms-types-faqitem</module>
|
||||||
<module>ccm-cms-types-externallink</module>
|
<module>ccm-cms-types-externallink</module>
|
||||||
<module>ccm-cms-types-newsitem</module>
|
<module>ccm-cms-types-newsitem</module>
|
||||||
</modules>
|
</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>
|
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
<excludeDefaults>true</excludeDefaults>
|
<excludeDefaults>true</excludeDefaults>
|
||||||
|
|
@ -125,12 +102,12 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.18.1</version>
|
<version>2.19.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>2.5.4</version>
|
<version>2.6</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
@ -150,11 +127,11 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-pmd-plugin</artifactId>
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.6</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<linkXref>true</linkXref>
|
<linkXref>true</linkXref>
|
||||||
<sourceEncoding>utf-8</sourceEncoding>
|
<sourceEncoding>utf-8</sourceEncoding>
|
||||||
<targetJdk>1.6</targetJdk>
|
<targetJdk>1.8</targetJdk>
|
||||||
<rulesets>
|
<rulesets>
|
||||||
<ruleset>/rulesets/basic.xml</ruleset>
|
<ruleset>/rulesets/basic.xml</ruleset>
|
||||||
<ruleset>/rulesets/braces.xml</ruleset>
|
<ruleset>/rulesets/braces.xml</ruleset>
|
||||||
|
|
@ -186,7 +163,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>findbugs-maven-plugin</artifactId>
|
<artifactId>findbugs-maven-plugin</artifactId>
|
||||||
<version>3.0.1</version>
|
<version>3.0.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<findbugsXmlOutput>true</findbugsXmlOutput>
|
<findbugsXmlOutput>true</findbugsXmlOutput>
|
||||||
<xmlOutput>true</xmlOutput>
|
<xmlOutput>true</xmlOutput>
|
||||||
|
|
@ -203,7 +180,12 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>de.jpdigital</groupId>
|
<groupId>de.jpdigital</groupId>
|
||||||
<artifactId>hibernate4-ddl-maven-plugin</artifactId>
|
<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>
|
||||||
<!--<plugin>
|
<!--<plugin>
|
||||||
<groupId>org.jboss.tattletale</groupId>
|
<groupId>org.jboss.tattletale</groupId>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue