CCM NG: Some fixes necessary because of the new configuration system
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3823 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
1afb8348ed
commit
53670572b2
|
|
@ -125,9 +125,9 @@ public class CategoryRepository extends AbstractEntityRepository<Long, Category>
|
||||||
final String[] tokens = normalizedPath.split("/");
|
final String[] tokens = normalizedPath.split("/");
|
||||||
Category current = domain.getRoot();
|
Category current = domain.getRoot();
|
||||||
for (String token : tokens) {
|
for (String token : tokens) {
|
||||||
// if (current.getSubCategories() == null) {
|
if (current.getSubCategories() == null) {
|
||||||
// LOGGER.error(new FormattedMessage("#findByPath(Domain, String): current category \"%s\" has no sub categories", current.getName()));
|
return null;
|
||||||
// }
|
}
|
||||||
final Optional<Category> result = current.getSubCategories()
|
final Optional<Category> result = current.getSubCategories()
|
||||||
.stream()
|
.stream()
|
||||||
.filter((c) -> {
|
.filter((c) -> {
|
||||||
|
|
|
||||||
|
|
@ -675,10 +675,6 @@ public class ConfigurationManager {
|
||||||
final Category category = categoryRepository.findByPath(registry,
|
final Category category = categoryRepository.findByPath(registry,
|
||||||
confName);
|
confName);
|
||||||
|
|
||||||
if (category == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
final T conf;
|
final T conf;
|
||||||
try {
|
try {
|
||||||
conf = confClass.newInstance();
|
conf = confClass.newInstance();
|
||||||
|
|
@ -689,6 +685,10 @@ public class ConfigurationManager {
|
||||||
ex);
|
ex);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (category == null) {
|
||||||
|
return conf;
|
||||||
|
}
|
||||||
|
|
||||||
final Field[] fields = confClass.getDeclaredFields();
|
final Field[] fields = confClass.getDeclaredFields();
|
||||||
for (final Field field : fields) {
|
for (final Field field : fields) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ import java.util.List;
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
@Category(IntegrationTest.class)
|
//@Category(IntegrationTest.class)
|
||||||
public class SecurityConfigTest {
|
public class SecurityConfigTest {
|
||||||
|
|
||||||
public SecurityConfigTest() {
|
public SecurityConfigTest() {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,216 @@
|
||||||
|
/*
|
||||||
|
* 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());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -94,10 +94,10 @@ public class ConfigurationManagerTest {
|
||||||
@Deployment
|
@Deployment
|
||||||
public static WebArchive createDeployment() {
|
public static WebArchive createDeployment() {
|
||||||
final PomEquippedResolveStage pom = Maven
|
final PomEquippedResolveStage pom = Maven
|
||||||
.resolver()
|
.resolver()
|
||||||
.loadPomFromFile("pom.xml");
|
.loadPomFromFile("pom.xml");
|
||||||
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) {
|
||||||
|
|
@ -106,29 +106,29 @@ public class ConfigurationManagerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.categorization.CategoryManagerTest.war").
|
"LibreCCM-org.libreccm.categorization.ConfigurationManagerTest.war")
|
||||||
addPackage(CcmObject.class.getPackage())
|
.addPackage(CcmObject.class.getPackage())
|
||||||
.addPackage(Permission.class.getPackage())
|
.addPackage(Permission.class.getPackage())
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.addPackage(CcmApplication.class.getPackage())
|
||||||
.addPackage(Categorization.class.getPackage())
|
.addPackage(Categorization.class.getPackage())
|
||||||
.addPackage(Configuration.class.getPackage())
|
.addPackage(Configuration.class.getPackage())
|
||||||
.addPackage(LocalizedString.class.getPackage())
|
.addPackage(LocalizedString.class.getPackage())
|
||||||
.addPackage(Workflow.class.getPackage())
|
.addPackage(Workflow.class.getPackage())
|
||||||
.addPackage(EntityManagerProducer.class.getPackage())
|
.addPackage(EntityManagerProducer.class.getPackage())
|
||||||
.addPackage(MimeTypeConverter.class.getPackage())
|
.addPackage(MimeTypeConverter.class.getPackage())
|
||||||
.addPackage(EqualsVerifier.class.getPackage())
|
.addPackage(EqualsVerifier.class.getPackage())
|
||||||
.addPackage(IntegrationTest.class.getPackage())
|
.addPackage(IntegrationTest.class.getPackage())
|
||||||
.addPackage(TestConfiguration.class.getPackage())
|
.addPackage(TestConfiguration.class.getPackage())
|
||||||
.addAsLibraries(libs)
|
.addAsLibraries(libs)
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource("test-persistence.xml",
|
||||||
"META-INF/persistence.xml")
|
"META-INF/persistence.xml")
|
||||||
.addAsResource(
|
.addAsResource(
|
||||||
"configs/org/libreccm/configuration/ConfigurationManagerTest/"
|
"configs/org/libreccm/configuration/ConfigurationManagerTest/"
|
||||||
+ "log4j2.xml",
|
+ "log4j2.xml",
|
||||||
"log4j2.xml")
|
"log4j2.xml")
|
||||||
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -139,7 +139,7 @@ public class ConfigurationManagerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@InSequence(2)
|
@InSequence(2)
|
||||||
public void datasetOnly() {
|
public void datasetOnly() {
|
||||||
System.out.println("Dataset loaded successfully.");
|
System.out.println("Dataset loaded successfully.");
|
||||||
|
|
@ -147,11 +147,11 @@ public class ConfigurationManagerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@InSequence(1100)
|
@InSequence(1100)
|
||||||
public void loadConfiguration() {
|
public void loadConfiguration() {
|
||||||
final ExampleConfiguration configuration = configurationManager
|
final ExampleConfiguration configuration = configurationManager
|
||||||
.findConfiguration(ExampleConfiguration.class);
|
.findConfiguration(ExampleConfiguration.class);
|
||||||
|
|
||||||
assertThat(configuration, is(not(nullValue())));
|
assertThat(configuration, is(not(nullValue())));
|
||||||
assertThat(configuration.getPrice(),
|
assertThat(configuration.getPrice(),
|
||||||
|
|
@ -162,20 +162,20 @@ public class ConfigurationManagerTest {
|
||||||
assertThat(configuration.getHelpUrl(),
|
assertThat(configuration.getHelpUrl(),
|
||||||
is(equalTo("http://www.example.org")));
|
is(equalTo("http://www.example.org")));
|
||||||
assertThat(configuration.getLanguages().size(), is(2));
|
assertThat(configuration.getLanguages().size(), is(2));
|
||||||
assertThat(configuration.getLanguages(), hasItem("de"));
|
assertThat(configuration.getLanguages(), hasItem("de"));
|
||||||
assertThat(configuration.getLanguages(), hasItem("en"));
|
assertThat(configuration.getLanguages(), hasItem("en"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
|
||||||
+ "after-save-changed.yml")
|
+ "after-save-changed.yml")
|
||||||
@InSequence(1200)
|
@InSequence(1200)
|
||||||
public void saveConfiguration() {
|
public void saveConfiguration() {
|
||||||
final ExampleConfiguration configuration = configurationManager
|
final ExampleConfiguration configuration = configurationManager
|
||||||
.findConfiguration(ExampleConfiguration.class);
|
.findConfiguration(ExampleConfiguration.class);
|
||||||
|
|
||||||
configuration.setPrice(new BigDecimal("109.99"));
|
configuration.setPrice(new BigDecimal("109.99"));
|
||||||
configuration.setItemsPerPage(30L);
|
configuration.setItemsPerPage(30L);
|
||||||
|
|
@ -186,21 +186,21 @@ public class ConfigurationManagerTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@InSequence(2100)
|
@InSequence(2100)
|
||||||
public void loadNewConfiguration() {
|
public void loadNewConfiguration() {
|
||||||
final TestConfiguration configuration = configurationManager
|
final TestConfiguration configuration = configurationManager
|
||||||
.findConfiguration(TestConfiguration.class);
|
.findConfiguration(TestConfiguration.class);
|
||||||
|
|
||||||
assertThat(configuration, is(nullValue()));
|
assertThat(configuration, is(nullValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
|
"datasets/org/libreccm/configuration/ConfigurationManagerTest/"
|
||||||
+ "after-save-new.yml")
|
+ "after-save-new.yml")
|
||||||
@InSequence(2200)
|
@InSequence(2200)
|
||||||
public void saveNewConfiguration() {
|
public void saveNewConfiguration() {
|
||||||
configurationManager.saveConfiguration(new TestConfiguration());
|
configurationManager.saveConfiguration(new TestConfiguration());
|
||||||
|
|
|
||||||
|
|
@ -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.apache.shiro.authc.UsernamePasswordToken;
|
import org.apache.shiro.authc.UsernamePasswordToken;
|
||||||
import org.apache.shiro.authz.AuthorizationException;
|
import org.apache.shiro.authz.AuthorizationException;
|
||||||
import org.apache.shiro.subject.Subject;
|
import org.apache.shiro.subject.Subject;
|
||||||
|
|
@ -48,19 +41,11 @@ 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.security.authorization.LabBean;
|
import org.libreccm.security.authorization.LabBean;
|
||||||
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 javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
@ -124,53 +109,44 @@ public class AuthorizationInterceptorTest {
|
||||||
return ShrinkWrap
|
return ShrinkWrap
|
||||||
.create(WebArchive.class,
|
.create(WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.security.AuthorizationInterceptorTest.war")
|
"LibreCCM-org.libreccm.security.AuthorizationInterceptorTest.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.core.CcmObject.class.getPackage())
|
||||||
.addPackage(CcmApplication.class.getPackage())
|
.addPackage(org.libreccm.configuration.ConfigurationManager.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.security.authorization.LabBean.class
|
||||||
.addPackage(XML.class.getPackage())
|
.getPackage())
|
||||||
.addPackage(DateTimeFormatter.class.getPackage())
|
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
|
||||||
.addPackage(LabBean.class.getPackage())
|
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||||
.addPackage(UncheckedWrapperException.class.getPackage())
|
.getPackage())
|
||||||
|
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
|
||||||
|
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
|
||||||
|
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||||
|
.getPackage())
|
||||||
|
.addPackage(com.arsdigita.runtime.CCMResourceManager.class
|
||||||
|
.getPackage())
|
||||||
|
.addPackage(com.arsdigita.util.UncheckedWrapperException.class
|
||||||
|
.getPackage())
|
||||||
|
.addPackage(com.arsdigita.web.CCMApplicationContextListener.class
|
||||||
|
.getPackage())
|
||||||
|
.addPackage(com.arsdigita.xml.XML.class.getPackage())
|
||||||
|
.addPackage(com.arsdigita.xml.formatters.DateTimeFormatter.class
|
||||||
|
.getPackage())
|
||||||
|
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||||
.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("META-INF/beans.xml", "beans.xml");
|
.addAsWebInfResource("META-INF/beans.xml", "beans.xml");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,26 @@ ccm_core.role_memberships:
|
||||||
role_id: -10003
|
role_id: -10003
|
||||||
member_id: -41004
|
member_id: -41004
|
||||||
ccm_core.ccm_objects:
|
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
|
||||||
- object_id: -20001
|
- object_id: -20001
|
||||||
display_name: object1
|
display_name: object1
|
||||||
- object_id: -20002
|
- object_id: -20002
|
||||||
display_name: object2
|
display_name: object2
|
||||||
- object_id: -20003
|
- object_id: -20003
|
||||||
display_name: object3
|
display_name: object3
|
||||||
|
- object_id: -301
|
||||||
|
display_name: screenName
|
||||||
ccm_core.permissions:
|
ccm_core.permissions:
|
||||||
# permission for privilege1 granted to role1
|
# permission for privilege1 granted to role1
|
||||||
- permission_id: -30001
|
- permission_id: -30001
|
||||||
|
|
@ -135,3 +149,61 @@ ccm_core.permissions:
|
||||||
granted_privilege: privilege3
|
granted_privilege: privilege3
|
||||||
object_id: -20001
|
object_id: -20001
|
||||||
grantee_id: -10003
|
grantee_id: -10003
|
||||||
|
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
|
||||||
|
ccm_core.settings:
|
||||||
|
- object_id: -301
|
||||||
|
name: primaryUserIdentifier
|
||||||
|
ccm_core.settings_string:
|
||||||
|
- object_id: -301
|
||||||
|
setting_value: screen_name
|
||||||
|
ccm_core.categorizations:
|
||||||
|
- categorization_id: -900
|
||||||
|
category_id: -204
|
||||||
|
object_id: -301
|
||||||
|
category_index: false
|
||||||
|
category_order: 1
|
||||||
|
object_order: 1
|
||||||
16
pom.xml
16
pom.xml
|
|
@ -256,12 +256,12 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator</artifactId>
|
<artifactId>hibernate-validator</artifactId>
|
||||||
<version>5.2.1.Final</version>
|
<version>5.2.2.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hibernate</groupId>
|
<groupId>org.hibernate</groupId>
|
||||||
<artifactId>hibernate-validator-cdi</artifactId>
|
<artifactId>hibernate-validator-cdi</artifactId>
|
||||||
<version>5.2.1.Final</version>
|
<version>5.2.2.Final</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
@ -297,7 +297,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-bom</artifactId>
|
<artifactId>log4j-bom</artifactId>
|
||||||
<version>2.3</version>
|
<version>2.5</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -451,14 +451,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.arquillian</groupId>
|
<groupId>org.jboss.arquillian</groupId>
|
||||||
<artifactId>arquillian-bom</artifactId>
|
<artifactId>arquillian-bom</artifactId>
|
||||||
<version>1.1.8.Final</version>
|
<version>1.1.10.Final</version>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jboss.arquillian.extension</groupId>
|
<groupId>org.jboss.arquillian.extension</groupId>
|
||||||
<artifactId>arquillian-transaction-bom</artifactId>
|
<artifactId>arquillian-transaction-bom</artifactId>
|
||||||
<version>1.0.1.Final</version>
|
<version>1.0.3.Final</version>
|
||||||
<type>pom</type>
|
<type>pom</type>
|
||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -492,7 +492,7 @@
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-core</artifactId>
|
<artifactId>hamcrest-core</artifactId>
|
||||||
<version>1.3</version>
|
<version>1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.hamcrest</groupId>
|
<groupId>org.hamcrest</groupId>
|
||||||
<artifactId>hamcrest-library</artifactId>
|
<artifactId>hamcrest-library</artifactId>
|
||||||
|
|
@ -508,14 +508,14 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>nl.jqno.equalsverifier</groupId>
|
<groupId>nl.jqno.equalsverifier</groupId>
|
||||||
<artifactId>equalsverifier</artifactId>
|
<artifactId>equalsverifier</artifactId>
|
||||||
<version>1.7.2</version>
|
<version>1.7.6</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- h2 database in used to check some database related things -->
|
<!-- h2 database in used to check some database related things -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.h2database</groupId>
|
<groupId>com.h2database</groupId>
|
||||||
<artifactId>h2</artifactId>
|
<artifactId>h2</artifactId>
|
||||||
<version>1.4.187</version>
|
<version>1.4.190</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue