Migrated all integration tests in ccm-core to run with the Maven Failsafe Plugin

Former-commit-id: a69c9ab0b8
pull/4/head
Jens Pelzetter 2020-07-14 22:04:22 +02:00
parent 2d89f1f16a
commit 2f56a11b35
28 changed files with 236 additions and 777 deletions

View File

@ -24,8 +24,8 @@ import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
import javax.enterprise.inject.Instance;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Reader;
@ -33,6 +33,8 @@ import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import javax.enterprise.context.RequestScoped;
/**
* This class provides access to the (local) file system. If available an
* implementation of the {@link FileSystemAdapter} interface is used. The

View File

@ -68,8 +68,8 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
@ -122,27 +122,9 @@ public class CategoryManagerIT {
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.categorization.CategoryManagerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.PermissionChecker.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
"LibreCCM-org.libreccm.categorization.CategoryManagerTest.war"
)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",
@ -393,8 +375,7 @@ public class CategoryManagerIT {
@UsingDataSet("datasets/org/libreccm/categorization/CategoryManagerTest"
+ "/data.yml")
@ShouldMatchDataSet(
excludeColumns = {
},
excludeColumns = {},
value = "datasets/org/libreccm/categorization/CategoryManagerTest"
+ "/after-remove-obj-from-category.yml"
)
@ -747,7 +728,7 @@ public class CategoryManagerIT {
/**
* Tries to retrieve the index object from several categories and verifies
* that the expected object is returned by null null null null null null
* null null {@link CategoryManager#getIndexObject(org.libreccm.categorization.Category).
* null null null null null {@link CategoryManager#getIndexObject(org.libreccm.categorization.Category).
*/
@Test
@UsingDataSet(

View File

@ -64,8 +64,8 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
@ -108,28 +108,11 @@ public class CategoryRepositoryIT {
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.categorization.CategoryRepositoryTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.PermissionChecker.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.imexport.Exportable.class)
.create(
WebArchive.class,
"LibreCCM-org.libreccm.categorization.CategoryRepositoryTest.war"
)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",
@ -247,7 +230,7 @@ public class CategoryRepositoryIT {
final Domain domain = domainRepo.findByDomainKey("test").get();
final Optional<Category> doesNotExist = categoryRepo.findByPath(domain,
"/does/not/exist");
"/does/not/exist");
assertThat(doesNotExist.isPresent(), is(false));
}

View File

@ -59,8 +59,8 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
@ -95,38 +95,21 @@ public class ConfigurationManagerIT {
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.configuration."
+ "ConfigurationManagerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addClass(com.example.TestConfiguration.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.create(
WebArchive.class,
"LibreCCM-org.libreccm.configuration.ConfigurationManagerTest.war"
)
.addPackages(true, "com.arsdigita", "org.libreccm", "com.example")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource(
"test-persistence.xml", "META-INF/persistence.xml"
)
.addAsResource(
"configs/org/libreccm/configuration/ConfigurationManagerTest/"
+ "log4j2.xml",
"log4j2.xml")
"log4j2.xml"
)
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource("META-INF/beans.xml", "beans.xml");
}

View File

@ -65,8 +65,8 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
@ -100,38 +100,15 @@ public class CcmObjectRepositoryIT {
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war")
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class.
getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addClass(org.libreccm.modules.CcmModule.class)
.addClass(org.libreccm.modules.ModuleEvent.class)
.addClass(org.libreccm.modules.InitEvent.class)
.addClass(org.libreccm.modules.InstallEvent.class)
.addClass(org.libreccm.modules.UnInstallEvent.class)
.addClass(org.libreccm.modules.ShutdownEvent.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackage(org.libreccm.security.PermissionChecker.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.create(
WebArchive.class,
"LibreCCM-org.libreccm.core.CcmObjectRepositoryTest.war"
)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")
.addAsResource(
"test-persistence.xml", "META-INF/persistence.xml"
)
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
@ -354,7 +331,8 @@ public class CcmObjectRepositoryIT {
@Test(expected = NullPointerException.class)
@ShouldThrowException(NullPointerException.class)
@UsingDataSet("datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml")
@ShouldMatchDataSet("datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml")
@ShouldMatchDataSet(
"datasets/org/libreccm/core/CcmObjectRepositoryTest/data.yml")
@InSequence(700)
public void deleteNullValue() {
ccmObjectRepository.delete(null);

View File

@ -38,7 +38,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
@ -209,26 +208,7 @@ public class GroupImportIT {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.imexport.GroupImportTest.war")
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.files.CcmFiles.class.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.imexport.Exportable.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.security.Group.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("imports", "imports")

View File

@ -38,7 +38,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
@ -213,26 +212,7 @@ public class GroupMembershipImportIT {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.imexport.GroupImportTest.war")
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.files.CcmFiles.class.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.imexport.Exportable.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.security.Group.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("imports", "imports")

View File

@ -38,7 +38,6 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.configuration.ConfigurationManager;
import org.libreccm.core.UnexpectedErrorException;
@ -208,26 +207,7 @@ public class UserImportIT {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.imexport.UserImportTest.war")
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.files.CcmFiles.class.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.imexport.Exportable.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("imports", "imports")

View File

@ -33,10 +33,8 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.configuration.ExampleConfiguration;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
import javax.persistence.EntityManager;
@ -51,7 +49,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -60,12 +57,12 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class ConfigurationLoaderTest {
public class ConfigurationLoaderIT {
@Inject
private EntityManager entityManager;
public ConfigurationLoaderTest() {
public ConfigurationLoaderIT() {
}
@BeforeClass
@ -89,19 +86,7 @@ public class ConfigurationLoaderTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.modules.ConfigurationLoaderTest.war")
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addClass(org.libreccm.modules.ConfigurationLoader.class)
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -34,13 +34,11 @@ import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.modules.dependencytree.test.cycle.TestModuleA;
import org.libreccm.modules.dependencytree.test.cycle.TestModuleB;
import org.libreccm.modules.dependencytree.test.cycle.TestModuleC;
import org.libreccm.modules.dependencytree.test.cycle.TestModuleRoot;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.ArrayList;
import java.util.List;
@ -51,13 +49,12 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
public class DependencyTreeManagerCycleTest {
public class DependencyTreeManagerCycleIT {
private Iterable<CcmModule> modules;
public DependencyTreeManagerCycleTest() {
public DependencyTreeManagerCycleIT() {
}
@BeforeClass
@ -87,32 +84,7 @@ public class DependencyTreeManagerCycleTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.modules.dependencytree.DependencyTreeManagerCycleTest.war")
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.modules.DependencyTreeManager.class)
.addClass(org.libreccm.modules.DependencyException.class)
.addClass(org.libreccm.modules.IntegrationException.class)
.addClass(TreeNode.class)
.addClass(org.libreccm.modules.CcmModule.class)
.addClass(org.libreccm.modules.ModuleEvent.class)
.addClass(org.libreccm.modules.ModuleInfo.class)
.addClass(org.libreccm.modules.ModuleStatus.class)
.addClass(org.libreccm.modules.Module.class)
.addClass(org.libreccm.modules.RequiredModule.class)
.addClass(org.libreccm.modules.InitEvent.class)
.addClass(org.libreccm.modules.InstallEvent.class)
.addClass(org.libreccm.modules.ShutdownEvent.class)
.addClass(org.libreccm.modules.UnInstallEvent.class)
.addClass(
org.libreccm.modules.dependencytree.test.cycle.TestModuleRoot.class)
.addClass(
org.libreccm.modules.dependencytree.test.cycle.TestModuleA.class)
.addClass(
org.libreccm.modules.dependencytree.test.cycle.TestModuleB.class)
.addClass(
org.libreccm.modules.dependencytree.test.cycle.TestModuleC.class)
.addPackage(org.libreccm.pagemodel.PageModel.class.getPackage())
.addClass(org.libreccm.web.ApplicationType.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource(

View File

@ -38,9 +38,7 @@ import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.ArrayList;
import java.util.List;
@ -51,13 +49,12 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
public class DependencyTreeManagerTest {
public class DependencyTreeManagerIT {
private Iterable<CcmModule> modules;
public DependencyTreeManagerTest() {
public DependencyTreeManagerIT() {
}
@BeforeClass
@ -100,33 +97,7 @@ public class DependencyTreeManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.modules.dependencytree.DependencyTreeManagerTest.war")
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.modules.DependencyTreeManager.class)
.addClass(org.libreccm.modules.DependencyException.class)
.addClass(org.libreccm.modules.IntegrationException.class)
.addClass(org.libreccm.modules.TreeNode.class)
.addClass(org.libreccm.modules.CcmModule.class)
.addClass(org.libreccm.modules.ModuleEvent.class)
.addClass(org.libreccm.modules.ModuleInfo.class)
.addClass(org.libreccm.modules.ModuleStatus.class)
.addClass(org.libreccm.modules.Module.class)
.addClass(org.libreccm.modules.RequiredModule.class)
.addClass(org.libreccm.modules.InitEvent.class)
.addClass(org.libreccm.modules.InstallEvent.class)
.addClass(org.libreccm.modules.ShutdownEvent.class)
.addClass(org.libreccm.modules.UnInstallEvent.class)
.addClass(
org.libreccm.modules.dependencytree.test.valid.TestModuleRoot.class)
.addClass(
org.libreccm.modules.dependencytree.test.valid.TestModuleA.class)
.addClass(
org.libreccm.modules.dependencytree.test.valid.TestModuleB.class)
.addClass(
org.libreccm.modules.dependencytree.test.valid.TestModuleC.class)
// .addClass(org.libreccm.portation.Portable.class)
.addPackage(org.libreccm.pagemodel.PageModel.class.getPackage())
.addClass(org.libreccm.web.ApplicationType.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource(

View File

@ -36,9 +36,7 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
import java.io.IOException;
@ -63,7 +61,6 @@ import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created on 12/1/16
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -170,8 +167,6 @@ public class CoreDataImportTest {
.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication
.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest
.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier
.class.getPackage())
.addAsLibraries(getModuleDependencies())

View File

@ -37,12 +37,10 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.security.authorization.LabBean;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
@ -58,16 +56,15 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class AuthorizationInterceptorTest {
public class AuthorizationInterceptorIT {
@Inject
private Subject subject;
@ -78,7 +75,7 @@ public class AuthorizationInterceptorTest {
@Inject
private LabBean labBean;
public AuthorizationInterceptorTest() {
public AuthorizationInterceptorIT() {
}
@BeforeClass
@ -102,37 +99,7 @@ public class AuthorizationInterceptorTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.AuthorizationInterceptorTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.security.authorization.LabBean.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.runtime.CCMResourceManager.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)
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -36,9 +36,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
import javax.servlet.ServletContext;
@ -56,7 +54,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -65,7 +62,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class ChallengeManagerTest {
public class ChallengeManagerIT {
@Inject
private ChallengeManager challengeManager;
@ -82,7 +79,7 @@ public class ChallengeManagerTest {
@Inject
private Shiro shiro;
public ChallengeManagerTest() {
public ChallengeManagerIT() {
}
@BeforeClass
@ -106,36 +103,7 @@ public class ChallengeManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.ChallengeManagerTest.war")
.addClass(com.arsdigita.runtime.CCMResourceManager.class)
.addPackage(com.arsdigita.util.Assert.class.getPackage())
.addClass(com.arsdigita.util.servlet.HttpHost.class)
.addPackage(com.arsdigita.web.URL.class.getPackage())
.addPackage(org.libreccm.security.OneTimeAuthManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(
org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -39,9 +39,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@ -55,7 +53,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -64,7 +61,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class GroupManagerTest {
public class GroupManagerIT {
@Inject
private GroupManager groupManager;
@ -78,7 +75,7 @@ public class GroupManagerTest {
@Inject
private Shiro shiro;
public GroupManagerTest() {
public GroupManagerIT() {
}
@BeforeClass
@ -102,30 +99,7 @@ public class GroupManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.GroupManagerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(
org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()).
addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -50,18 +50,16 @@ import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.Optional;
import org.jboss.arquillian.persistence.TestExecutionPhase;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -70,7 +68,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class GroupRepositoryTest {
public class GroupRepositoryIT {
private static final String ADMINS = "admins";
private static final String USERS = "users";
@ -83,7 +81,7 @@ public class GroupRepositoryTest {
@PersistenceContext
private EntityManager entityManager;
public GroupRepositoryTest() {
public GroupRepositoryIT() {
}
@ -108,24 +106,7 @@ public class GroupRepositoryTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.UserRepositoryTest.war")
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -44,9 +44,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.List;
@ -62,16 +60,15 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class OneTimeAuthManagerTest {
public class OneTimeAuthManagerIT {
@Inject
private OneTimeAuthManager oneTimeAuthManager;
@ -82,7 +79,7 @@ public class OneTimeAuthManagerTest {
@Inject
private Shiro shiro;
public OneTimeAuthManagerTest() {
public OneTimeAuthManagerIT() {
}
@ -107,29 +104,7 @@ public class OneTimeAuthManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.OneTimeAuthManagerTest.war")
.addPackage(org.libreccm.security.OneTimeAuthManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",
@ -214,9 +189,9 @@ public class OneTimeAuthManagerTest {
final List<OneTimeAuthToken> result = shiro.getSystemUser().execute(
() -> {
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
assertThat(result, is(not(nullValue())));
assertThat(result, is(not(empty())));
@ -237,9 +212,9 @@ public class OneTimeAuthManagerTest {
final List<OneTimeAuthToken> result = shiro.getSystemUser().execute(
() -> {
return oneTimeAuthManager.retrieveForUser(
mmuster, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
return oneTimeAuthManager.retrieveForUser(
mmuster, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
assertThat(result, is(empty()));
}
@ -284,11 +259,11 @@ public class OneTimeAuthManagerTest {
shiro.getSystemUser().execute(
() -> {
assertThat(
oneTimeAuthManager.validTokenExistsForUser(
user, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION),
is(true));
});
assertThat(
oneTimeAuthManager.validTokenExistsForUser(
user, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION),
is(true));
});
}
@Test
@ -300,11 +275,11 @@ public class OneTimeAuthManagerTest {
shiro.getSystemUser().execute(
() -> {
assertThat(
oneTimeAuthManager.validTokenExistsForUser(
user, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION),
is(false));
});
assertThat(
oneTimeAuthManager.validTokenExistsForUser(
user, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION),
is(false));
});
}
@Test(expected = IllegalArgumentException.class)
@ -346,15 +321,15 @@ public class OneTimeAuthManagerTest {
final List<OneTimeAuthToken> result = shiro.getSystemUser().execute(
() -> {
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
assertThat(result, is(not(empty())));
shiro.getSystemUser().execute(
() -> {
assertThat(oneTimeAuthManager.isValid(result.get(0)),
is(true));
});
assertThat(oneTimeAuthManager.isValid(result.get(0)),
is(true));
});
}
@Test
@ -366,9 +341,9 @@ public class OneTimeAuthManagerTest {
final List<OneTimeAuthToken> result = shiro.getSystemUser().execute(
() -> {
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
assertThat(result, is(not(empty())));
final OneTimeAuthToken token = result.get(0);
@ -379,8 +354,8 @@ public class OneTimeAuthManagerTest {
shiro.getSystemUser().execute(
() -> {
assertThat(oneTimeAuthManager.isValid(token), is(false));
});
assertThat(oneTimeAuthManager.isValid(token), is(false));
});
}
@ -410,9 +385,9 @@ public class OneTimeAuthManagerTest {
final List<OneTimeAuthToken> result = shiro.getSystemUser().execute(
() -> {
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
return oneTimeAuthManager.retrieveForUser(
jdoe, OneTimeAuthTokenPurpose.EMAIL_VERIFICATION);
});
assertThat(result, is(not(empty())));
shiro.getSystemUser().execute(

View File

@ -36,10 +36,8 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.EmailAddress;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
import javax.persistence.EntityManager;
@ -59,20 +57,22 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class PartyRepositoryTest {
public class PartyRepositoryIT {
private static final String MMUSTER = "mmuster";
private static final String JDOE = "jdoe";
private static final String ADMINS = "admins";
private static final String MANAGERS = "managers";
@Inject
@ -84,7 +84,7 @@ public class PartyRepositoryTest {
@PersistenceContext
private EntityManager entityManager;
public PartyRepositoryTest() {
public PartyRepositoryIT() {
}
@BeforeClass
@ -108,29 +108,7 @@ public class PartyRepositoryTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.UserRepositoryTest.war")
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(
org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -44,11 +44,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.ArrayList;
import java.util.List;
@ -65,74 +63,53 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class PermissionCheckerTest {
public class PermissionCheckerIT {
@Inject
private Subject subject;
@Inject
private Shiro shiro;
@Inject
private PermissionChecker permissionChecker;
@Inject
private CcmObjectRepository objectRepository;
public PermissionCheckerTest() {
public PermissionCheckerIT() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
@Deployment
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.PermissionCheckerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackages(true, "com.arsdigita", "org.libreccm")
.addClass(org.libreccm.imexport.Exportable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
@ -144,7 +121,7 @@ public class PermissionCheckerTest {
.addAsWebInfResource("test-web.xml", "web.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(1100)
@ -153,12 +130,12 @@ public class PermissionCheckerTest {
"foo123");
token.setRememberMe(true);
subject.login(token);
assertThat(permissionChecker.isPermitted("privilege1"), is(false));
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(1200)
@ -167,7 +144,7 @@ public class PermissionCheckerTest {
assertThat(permissionChecker.isPermitted("privilege2"), is(false));
assertThat(permissionChecker.isPermitted("privilege3"), is(false));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(1300)
@ -175,9 +152,9 @@ public class PermissionCheckerTest {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject object2 = objectRepository.findById(20002L).get();
final CcmObject object3 = objectRepository.findById(20003L).get();
shiro.getSystemUser().execute(new Callable<Boolean>() {
@Override
public Boolean call() {
assertThat(permissionChecker.isPermitted("privilege1"),
@ -186,7 +163,7 @@ public class PermissionCheckerTest {
is(true));
assertThat(permissionChecker.isPermitted("privilege3"),
is(true));
assertThat(permissionChecker.isPermitted("privilege1",
object2),
is(true));
@ -196,42 +173,42 @@ public class PermissionCheckerTest {
assertThat(permissionChecker.isPermitted("privilege3",
object3),
is(true));
return false;
}
});
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(1400)
public void isPermittedObjectAuthenticatedUser() {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject object2 = objectRepository.findById(20002L).get();
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
"foo123");
token.setRememberMe(true);
subject.login(token);
assertThat(permissionChecker.isPermitted("privilege1", object1),
is(false));
assertThat(permissionChecker.isPermitted("privilege2", object1),
is(false));
assertThat(permissionChecker.isPermitted("privilege2", object2),
is(true));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(1500)
public void isPermittedObjectUnAuthenticatedUser() {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject object2 = objectRepository.findById(20002L).get();
assertThat(permissionChecker.isPermitted("privilege1", object1),
is(false));
assertThat(permissionChecker.isPermitted("privilege2", object1),
@ -241,7 +218,7 @@ public class PermissionCheckerTest {
assertThat(permissionChecker.isPermitted("privilege3", object1),
is(true));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(2100)
@ -250,10 +227,10 @@ public class PermissionCheckerTest {
"foo123");
token.setRememberMe(true);
subject.login(token);
permissionChecker.checkPermission("privilege1");
}
@Test(expected = AuthorizationException.class)
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@ShouldThrowException(AuthorizationException.class)
@ -261,40 +238,40 @@ public class PermissionCheckerTest {
public void checkPermissionUnAuthenticatedUser() {
permissionChecker.checkPermission("privilege1");
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(2300)
public void checkPermissionObjectAuthenticatedUser() {
final CcmObject object2 = objectRepository.findById(20002L).get();
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
"foo123");
token.setRememberMe(true);
subject.login(token);
permissionChecker.checkPermission("privilege2", object2);
}
@Test(expected = AuthorizationException.class)
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@ShouldThrowException(AuthorizationException.class)
@InSequence(2400)
public void checkPermissionObjectUnAuthenticatedUser() {
final CcmObject object2 = objectRepository.findById(20002L).get();
permissionChecker.checkPermission("privilege2", object2);
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(2500)
public void checkPermissionObjectPublicUser() {
final CcmObject object1 = objectRepository.findById(20001L).get();
permissionChecker.checkPermission("privilege3", object1);
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(2600)
@ -302,69 +279,69 @@ public class PermissionCheckerTest {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject object2 = objectRepository.findById(20002L).get();
final CcmObject object3 = objectRepository.findById(20003L).get();
shiro.getSystemUser().execute(new Callable<Boolean>() {
@Override
public Boolean call() {
permissionChecker.checkPermission("privilege1");
permissionChecker.checkPermission("privilege2");
permissionChecker.checkPermission("privilege3");
permissionChecker.checkPermission("privilege1", object3);
permissionChecker.checkPermission("privilege2", object1);
permissionChecker.checkPermission("privilege3", object2);
return false;
}
});
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(3100)
public void checkPermissionReturnObjectAuthenticatedUser() {
final CcmObject object2 = objectRepository.findById(20002L).get();
final UsernamePasswordToken token = new UsernamePasswordToken("jdoe",
"foo123");
token.setRememberMe(true);
subject.login(token);
final CcmObject result = permissionChecker.checkPermission(
"privilege2", object2, CcmObject.class);
assertThat(result.getDisplayName(), is(equalTo("object2")));
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
assertThat(result, is(equalTo(object2)));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(3200)
public void checkPermissionReturnObjectUnAuthenticatedUser() {
final CcmObject object2 = objectRepository.findById(20002L).get();
final CcmObject result = permissionChecker.checkPermission(
"privilege2", object2, CcmObject.class);
assertThat(result.getDisplayName(), is(equalTo(ACCESS_DENIED)));
assertThat(permissionChecker.isAccessDeniedObject(result), is(true));
assertThat(result, is(not(equalTo(object2))));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(600)
public void checkPermissionReturnObjectPublicUser() {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject result = permissionChecker.checkPermission(
"privilege3", object1, CcmObject.class);
assertThat(result.getDisplayName(), is(equalTo("object1")));
assertThat(permissionChecker.isAccessDeniedObject(result), is(false));
assertThat(result, is(equalTo(object1)));
}
@Test
@UsingDataSet("datasets/org/libreccm/security/ShiroTest/data.yml")
@InSequence(3200)
@ -372,48 +349,48 @@ public class PermissionCheckerTest {
final CcmObject object1 = objectRepository.findById(20001L).get();
final CcmObject object2 = objectRepository.findById(20002L).get();
final CcmObject object3 = objectRepository.findById(20003L).get();
final List<CcmObject> results = shiro.getSystemUser().execute(
new Callable<List<CcmObject>>() {
@Override
public List<CcmObject> call() {
permissionChecker.checkPermission("privilege1");
permissionChecker.checkPermission("privilege2");
permissionChecker.checkPermission("privilege3");
final CcmObject result3 = permissionChecker.checkPermission(
"privilege1", object3, CcmObject.class);
final CcmObject result1 = permissionChecker.checkPermission(
"privilege2", object1, CcmObject.class);
final CcmObject result2 = permissionChecker.checkPermission(
"privilege3", object2, CcmObject.class);
final List<CcmObject> results = new ArrayList<>();
results.add(result1);
results.add(result2);
results.add(result3);
return results;
}
});
final CcmObject result1 = results.get(0);
final CcmObject result2 = results.get(1);
final CcmObject result3 = results.get(2);
assertThat(result1.getDisplayName(), is(equalTo("object1")));
assertThat(permissionChecker.isAccessDeniedObject(result1), is(false));
assertThat(result1, is(equalTo(object1)));
assertThat(result2.getDisplayName(), is(equalTo("object2")));
assertThat(permissionChecker.isAccessDeniedObject(result2), is(false));
assertThat(result2, is(equalTo(object2)));
assertThat(result3.getDisplayName(), is(equalTo("object3")));
assertThat(permissionChecker.isAccessDeniedObject(result3), is(false));
assertThat(result3, is(equalTo(object3)));
}
}

View File

@ -36,11 +36,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
import javax.persistence.EntityManager;
@ -55,6 +53,7 @@ import org.libreccm.categorization.CategorizationConstants;
import org.libreccm.core.CoreConstants;
import java.util.List;
import org.jboss.arquillian.persistence.TestExecutionPhase;
/**
@ -63,7 +62,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -72,7 +70,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class PermissionManagerTest {
public class PermissionManagerIT {
@Inject
private PermissionManager permissionManager;
@ -89,7 +87,7 @@ public class PermissionManagerTest {
@Inject
private Shiro shiro;
public PermissionManagerTest() {
public PermissionManagerIT() {
}
@BeforeClass
@ -112,29 +110,8 @@ public class PermissionManagerTest {
public static WebArchive createDeployment() {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.PermissionManagerTest.war").
addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()).
addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
"LibreCCM-org.libreccm.security.PermissionManagerTest.war")
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -36,9 +36,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import javax.inject.Inject;
@ -54,16 +52,15 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class RoleManagerTest {
public class RoleManagerIT {
@Inject
private RoleManager roleManager;
@ -77,7 +74,7 @@ public class RoleManagerTest {
@Inject
private Shiro shiro;
public RoleManagerTest() {
public RoleManagerIT() {
}
@BeforeClass
@ -101,27 +98,7 @@ public class RoleManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.RoleManagerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackages(true, "com.arsdigita", "org.libreccm")
.addClass(org.libreccm.imexport.Exportable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
@ -204,7 +181,7 @@ public class RoleManagerTest {
@UsingDataSet("datasets/org/libreccm/security/RoleManagerTest/data.yml")
@ShouldMatchDataSet(
value
= "datasets/org/libreccm/security/RoleManagerTest/after-remove.yml",
= "datasets/org/libreccm/security/RoleManagerTest/after-remove.yml",
excludeColumns = {"membership_id"})
@InSequence(300)
public void removeRoleFromParty() {

View File

@ -36,9 +36,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.List;
@ -65,7 +63,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -74,7 +71,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class RoleRepositoryTest {
public class RoleRepositoryIT {
private static final String ADMINISTRATOR = "administrator";
private static final String USER = "user";
@ -89,7 +86,7 @@ public class RoleRepositoryTest {
@PersistenceContext
private EntityManager entityManager;
public RoleRepositoryTest() {
public RoleRepositoryIT() {
}
@BeforeClass
@ -113,24 +110,7 @@ public class RoleRepositoryTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.RoleRepositoryTest.war")
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(
org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage()).
addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackages(true, "com.arsdigita", "org.libreccm")
.addClass(org.libreccm.imexport.Exportable.class)
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")

View File

@ -19,6 +19,8 @@
package org.libreccm.security;
import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
@ -43,25 +45,24 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.tests.categories.IntegrationTest;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
import static org.libreccm.testutils.DependenciesHelpers.*;
import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.jboss.arquillian.persistence.TestExecutionPhase;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -70,7 +71,7 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class SecuredCollectionTest {
public class SecuredCollectionIT {
private static final String ACCESS_DENIED = "Access denied";
@ -87,7 +88,7 @@ public class SecuredCollectionTest {
private SecuredCollection<CcmObject> collection2;
private SecuredCollection<CcmObject> collection3;
public SecuredCollectionTest() {
public SecuredCollectionIT() {
}
@BeforeClass
@ -129,27 +130,7 @@ public class SecuredCollectionTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.SecuredCollectionTest.war")
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -18,7 +18,6 @@
*/
package org.libreccm.security;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.jboss.arquillian.container.test.api.Deployment;
@ -37,11 +36,9 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.CcmObject;
import org.libreccm.core.CcmObjectRepository;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.ArrayList;
import java.util.Iterator;
@ -62,16 +59,15 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class SecuredIteratorTest {
public class SecuredIteratorIT {
private static final String ACCESS_DENIED = "Access denied";
@ -86,10 +82,12 @@ public class SecuredIteratorTest {
//private List<CcmObject> list;
private Iterator<CcmObject> iterator1;
private Iterator<CcmObject> iterator2;
private Iterator<CcmObject> iterator3;
public SecuredIteratorTest() {
public SecuredIteratorIT() {
}
@BeforeClass
@ -131,27 +129,7 @@ public class SecuredIteratorTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.SecuredIteratorTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -44,9 +44,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
@ -60,7 +58,6 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@ -69,12 +66,12 @@ import org.jboss.arquillian.persistence.TestExecutionPhase;
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class ShiroTest {
public class ShiroIT {
@Inject
private Subject subject;
public ShiroTest() {
public ShiroIT() {
}
@BeforeClass
@ -115,8 +112,6 @@ public class ShiroTest {
.addClass(org.libreccm.modules.UnInstallEvent.class)
.addClass(org.libreccm.modules.ShutdownEvent.class)
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())

View File

@ -24,8 +24,6 @@ import javax.inject.Inject;
import org.hibernate.exception.ConstraintViolationException;
import static org.hamcrest.Matchers.*;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.junit.Arquillian;
@ -44,9 +42,7 @@ import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.tests.categories.IntegrationTest;
import static org.junit.Assert.*;
@ -55,20 +51,23 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.jboss.arquillian.persistence.TestExecutionPhase;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class UserManagerTest {
public class UserManagerIT {
@Inject
private UserManager userManager;
@ -79,7 +78,7 @@ public class UserManagerTest {
@Inject
private Shiro shiro;
public UserManagerTest() {
public UserManagerIT() {
}
@BeforeClass
@ -103,29 +102,7 @@ public class UserManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.UserManagerTest.war")
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
.getPackage())
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -20,8 +20,6 @@ package org.libreccm.security;
import org.junit.Test;
import static org.hamcrest.Matchers.*;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.ShouldThrowException;
import org.jboss.arquillian.junit.Arquillian;
@ -44,10 +42,8 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
import org.jboss.arquillian.persistence.CleanupUsingScript;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.core.EmailAddress;
import org.libreccm.tests.categories.IntegrationTest;
import java.util.List;
import java.util.Optional;
@ -55,26 +51,34 @@ import java.util.Optional;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.jboss.arquillian.persistence.TestExecutionPhase;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
/**
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@Category(IntegrationTest.class)
@RunWith(Arquillian.class)
@PersistenceTest
@Transactional(TransactionMode.COMMIT)
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
@CreateSchema({"001_create_schema.sql",
"002_create_ccm_core_tables.sql",
"003_init_hibernate_sequence.sql"})
@CleanupUsingScript(value = {"999_cleanup.sql"},
phase = TestExecutionPhase.BEFORE)
public class UserRepositoryTest {
public class UserRepositoryIT {
private static final String NOBODY = "nobody";
private static final String JOE = "joe";
private static final String MMUSTER = "mmuster";
private static final String JDOE = "jdoe";
@Inject
@ -86,7 +90,7 @@ public class UserRepositoryTest {
@PersistenceContext
private EntityManager entityManager;
public UserRepositoryTest() {
public UserRepositoryIT() {
}
@BeforeClass
@ -110,27 +114,7 @@ public class UserRepositoryTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.security.UserRepositoryTest.war")
.addPackage(org.libreccm.security.User.class.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.configuration.Configuration.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class
.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
.addClass(com.arsdigita.kernel.KernelConfig.class)
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
.addClass(org.libreccm.imexport.Exportable.class)
.addPackages(true, "com.arsdigita", "org.libreccm")
.addAsLibraries(getModuleDependencies())
.addAsResource("configs/shiro.ini", "shiro.ini")
.addAsResource("test-persistence.xml",

View File

@ -20,7 +20,7 @@ package org.libreccm.security.authorization;
import org.apache.shiro.subject.Subject;
import org.libreccm.core.CcmObject;
import org.libreccm.security.AuthorizationInterceptorTest;
import org.libreccm.security.AuthorizationInterceptorIT;
import org.libreccm.security.AuthorizationRequired;
import org.libreccm.security.RequiresPrivilege;
import org.libreccm.security.RequiresRole;
@ -32,7 +32,7 @@ import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
/**
* A simple bean used by the {@link AuthorizationInterceptorTest}.
* A simple bean used by the {@link AuthorizationInterceptorIT}.
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/