CCM NG:
- Removed @StartUp annotation from OneTimeAuthTokenCleaner. With this annotation this EJB is initalized *before* the schema migrations have been applied. Because the init method of the bean accesses the database that causes the whole deployment to fail if it is a fresh installation - Added saxon library to the dependencies for the test profiles in ccm-docrepo git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3983 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
ad1ec92626
commit
50e0809c4f
|
|
@ -1094,6 +1094,10 @@
|
|||
<artifactId>arquillian-jacoco</artifactId>
|
||||
<version>1.0.0.Alpha8</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -1116,7 +1120,6 @@
|
|||
<configuration>
|
||||
<dialects>
|
||||
<param>h2</param>
|
||||
<param>mysql5_innodb</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
<packages>
|
||||
|
|
@ -1157,90 +1160,6 @@
|
|||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>wildfly-remote-mysql</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wildfly</groupId>
|
||||
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
||||
<!--<version>8.2.1.Final</version>-->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>org.jacoco.core</artifactId>
|
||||
<!--<version>0.7.5.201505241946</version>-->
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>org.jboss.arquillian.extension</groupId>
|
||||
<artifactId>arquillian-jacoco</artifactId>
|
||||
<version>1.0.0.Alpha8</version>
|
||||
</dependency>-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/resources-wildfly8-remote-mysql</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate4-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<param>h2</param>
|
||||
<param>mysql5_innodb</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
<useEnvers>true</useEnvers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>gen-ddl</goal>
|
||||
</goals>
|
||||
<phase>process-classes</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19.1</version>
|
||||
<configuration>
|
||||
<forkMode>always</forkMode>
|
||||
<forkCount>999</forkCount>
|
||||
<reuseForks>true</reuseForks>
|
||||
<systemPropertyVariables>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
<jboss.home>${project.basedir}/target/wildfly-8.2.0.Final</jboss.home>
|
||||
<module.path>${project.basedir}/target/wildfly-8.2.0.Final/modules</module.path>
|
||||
</systemPropertyVariables>
|
||||
<redirectTestOutputToFile>false</redirectTestOutputToFile>
|
||||
<groups>
|
||||
org.libreccm.tests.categories.UnitTest,
|
||||
org.libreccm.tests.categories.IntegrationTest
|
||||
</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@ import java.util.List;
|
|||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.Resource;
|
||||
import javax.ejb.DependsOn;
|
||||
import javax.ejb.Singleton;
|
||||
import javax.ejb.Startup;
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.Timeout;
|
||||
import javax.ejb.TimerConfig;
|
||||
import javax.ejb.TimerService;
|
||||
|
|
@ -45,8 +47,9 @@ import javax.transaction.Transactional;
|
|||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Startup
|
||||
//@Startup
|
||||
@Singleton
|
||||
//@Stateless
|
||||
public class OneTimeAuthTokenCleaner {
|
||||
|
||||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
|
|
@ -75,7 +78,7 @@ public class OneTimeAuthTokenCleaner {
|
|||
|
||||
LOGGER.debug("Creating interval for {} s.", interval / 1000);
|
||||
LOGGER.debug("First run cleaning process will be executed in 5 min.");
|
||||
timerService.createIntervalTimer(5 * 60 * 1000,
|
||||
timerService.createIntervalTimer(interval,
|
||||
interval,
|
||||
new TimerConfig());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,6 +360,10 @@
|
|||
<artifactId>arquillian-jacoco</artifactId>
|
||||
<version>1.0.0.Alpha8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
|
@ -370,9 +374,9 @@
|
|||
<testResource>
|
||||
<directory>src/test/resources-wildfly-remote-h2-mem</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<!--<testResource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</testResource>
|
||||
</testResource>-->
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
|
|
@ -382,7 +386,6 @@
|
|||
<configuration>
|
||||
<dialects>
|
||||
<param>h2</param>
|
||||
<param>mysql5_innodb</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
<packages>
|
||||
|
|
@ -420,6 +423,89 @@
|
|||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>wildfly-remote-pgsql</id>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.wildfly</groupId>
|
||||
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>org.jacoco.core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian.extension</groupId>
|
||||
<artifactId>arquillian-jacoco</artifactId>
|
||||
<version>1.0.0.Alpha8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.saxon</groupId>
|
||||
<artifactId>Saxon-HE</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>src/test/resources-wildfly-remote-pgsql</directory>
|
||||
</testResource>
|
||||
<!--<testResource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</testResource>-->
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate4-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
<useEnvers>true</useEnvers>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>gen-ddl</goal>
|
||||
</goals>
|
||||
<phase>process-classes</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.19.1</version>
|
||||
<configuration>
|
||||
<forkMode>always</forkMode>
|
||||
<forkCount>999</forkCount>
|
||||
<reuseForks>true</reuseForks>
|
||||
<systemPropertyVariables>
|
||||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||
</systemPropertyVariables>
|
||||
<redirectTestOutputToFile>false</redirectTestOutputToFile>
|
||||
<groups>
|
||||
org.libreccm.tests.categories.UnitTest,
|
||||
org.libreccm.tests.categories.IntegrationTest
|
||||
</groups>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
</profiles>
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -37,9 +37,11 @@ import org.libreccm.docrepo.File;
|
|||
import org.libreccm.docrepo.FileMarshaller;
|
||||
import org.libreccm.docrepo.FileRepository;
|
||||
import org.libreccm.portation.Format;
|
||||
import org.libreccm.portation.Marshals;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
|
@ -64,17 +66,16 @@ import static org.junit.Assert.assertTrue;
|
|||
@CreateSchema({"create_ccm_docrepo_schema.sql"})
|
||||
public class FilePortationTest {
|
||||
|
||||
|
||||
|
||||
@Inject
|
||||
private FileRepository fileRepository;
|
||||
|
||||
@Inject
|
||||
@Marshals(File.class)
|
||||
private FileMarshaller fileMarshaller;
|
||||
|
||||
private static File file;
|
||||
private static String filePath =
|
||||
"/home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/";
|
||||
// private static File file;
|
||||
// private static String filePath
|
||||
// = "/home/tosmers/Svn/libreccm/ccm_ng/ccm-docrepo/src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/";
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
|
|
@ -90,13 +91,13 @@ public class FilePortationTest {
|
|||
|
||||
@Before
|
||||
public void setUp() {
|
||||
file = new File();
|
||||
file.setName("testname");
|
||||
file.setDescription("this is a text description");
|
||||
file.setPath("test/path");
|
||||
file.setCreationDate(new Date());
|
||||
file.setLastModifiedDate(new Date());
|
||||
fileRepository.save(file);
|
||||
// file = new File();
|
||||
// file.setName("testname");
|
||||
// file.setDescription("this is a text description");
|
||||
// file.setPath("test/path");
|
||||
// file.setCreationDate(new Date());
|
||||
// file.setLastModifiedDate(new Date());
|
||||
// fileRepository.save(file);
|
||||
}
|
||||
|
||||
@After
|
||||
|
|
@ -108,38 +109,55 @@ public class FilePortationTest {
|
|||
final PomEquippedResolveStage pom = Maven
|
||||
.resolver()
|
||||
.loadPomFromFile("pom.xml");
|
||||
final PomEquippedResolveStage dependencies = pom.importCompileAndRuntimeDependencies();
|
||||
final java.io.File[] libs = dependencies.resolve().withTransitivity().asFile();
|
||||
final PomEquippedResolveStage dependencies = pom
|
||||
.importCompileAndRuntimeDependencies();
|
||||
final java.io.File[] libs = dependencies.resolve().withTransitivity()
|
||||
.asFile();
|
||||
|
||||
for (java.io.File lib : libs) {
|
||||
System.err.printf("Adding file '%s' to test archive...%n", lib.getName());
|
||||
System.err.printf("Adding file '%s' to test archive...%n", lib
|
||||
.getName());
|
||||
}
|
||||
|
||||
final PomEquippedResolveStage corePom = Maven.resolver().loadPomFromFile("../ccm-core/pom.xml");
|
||||
final PomEquippedResolveStage coreDependencies = corePom.importCompileAndRuntimeDependencies();
|
||||
final java.io.File[] coreLibs = coreDependencies.resolve().withTransitivity().asFile();
|
||||
final PomEquippedResolveStage corePom = Maven.resolver()
|
||||
.loadPomFromFile("../ccm-core/pom.xml");
|
||||
final PomEquippedResolveStage coreDependencies = corePom
|
||||
.importCompileAndRuntimeDependencies();
|
||||
final java.io.File[] coreLibs = coreDependencies.resolve()
|
||||
.withTransitivity().asFile();
|
||||
for (java.io.File lib : coreLibs) {
|
||||
System.err.printf("Adding file '%s' to test archive...%n", lib.getName());
|
||||
System.err.printf("Adding file '%s' to test archive...%n", lib
|
||||
.getName());
|
||||
}
|
||||
|
||||
return ShrinkWrap
|
||||
.create(WebArchive.class,
|
||||
"LibreCCM-org.libreccm.docrepo.FilePortationTest.war")
|
||||
.addPackage(org.libreccm.auditing.AbstractAuditedEntityRepository.class.getPackage())
|
||||
.addPackage(org.libreccm.categorization.Categorization.class.getPackage())
|
||||
.addPackage(org.libreccm.configuration.ConfigurationManager.class.getPackage())
|
||||
.addPackage(
|
||||
org.libreccm.auditing.AbstractAuditedEntityRepository.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.categorization.Categorization.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.configuration.ConfigurationManager.class
|
||||
.getPackage())
|
||||
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
|
||||
.addPackage(org.libreccm.docrepo.FileMarshaller.class.getPackage())
|
||||
.addPackage(org.libreccm.jpa.EntityManagerProducer.class.getPackage())
|
||||
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.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.portal.Portlet.class.getPackage())
|
||||
.addPackage(org.libreccm.portation.AbstractMarshaller.class.getPackage())
|
||||
.addPackage(org.libreccm.portation.AbstractMarshaller.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())
|
||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class.getPackage())
|
||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||
.getPackage())
|
||||
.addPackage(com.arsdigita.xml.CCMTransformerFactory.class
|
||||
.getPackage())
|
||||
.addAsLibraries(libs)
|
||||
.addAsLibraries(coreLibs)
|
||||
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
|
||||
|
|
@ -150,13 +168,13 @@ public class FilePortationTest {
|
|||
@Test
|
||||
@InSequence(10)
|
||||
public void fileMarshallerIsInjected() {
|
||||
//assertThat(fileMarshaller, is(not(nullValue())));
|
||||
assertThat(fileMarshaller, is(not(nullValue())));
|
||||
}
|
||||
|
||||
@Test
|
||||
@InSequence(20)
|
||||
public void fileRepositoryIsInjected() {
|
||||
// assertThat(fileRepository, is(not(nullValue())));
|
||||
assertThat(fileRepository, is(not(nullValue())));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
DROP SCHEMA IF EXISTS ccm_docrepo;
|
||||
DROP SCHEMA IF EXISTS ccm_core;
|
||||
|
||||
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||
|
||||
CREATE SCHEMA ccm_core;
|
||||
CREATE SCHEMA ccm_docrepo;
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<arquillian xmlns="http://jboss.org/schema/arquillian"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jboss.org/schema/arquillian
|
||||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd" >
|
||||
|
||||
<engine>
|
||||
<property name="deploymentExportPath">target/deployments</property>
|
||||
</engine>
|
||||
<defaultProtocol type="Servlet 3.0"/>
|
||||
<!--<property name="javaVmArguments">
|
||||
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
|
||||
</property>-->
|
||||
|
||||
<extension qualifier="persistence">
|
||||
<property name="defaultDataSource">java:/comp/env/jdbc/org/libreccm/ccm-docrepo/pgsql</property>
|
||||
|
||||
<!--
|
||||
Disable automatic cleanup, does not work because of referential
|
||||
integrity constrains.
|
||||
-->
|
||||
<property name="defaultCleanupPhase">NONE</property>
|
||||
|
||||
<property name="dumpData">true</property>
|
||||
<property name="dumpDirectory">target</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-dbunit">
|
||||
<property name="defaultDataSetFormat">json</property>
|
||||
<!--<property name="datatypeFactory">org.dbunit.ext.h2.H2DataTypeFactory</property>-->
|
||||
<property name="excludePoi">true</property>
|
||||
<property name="qualifiedTableNames">true</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-script">
|
||||
<property name="scriptsToExecuteAfterTest">scripts/pgsql-cleanup.sql</property>
|
||||
</extension>
|
||||
|
||||
|
||||
</arquillian>
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
author: Jens Pelzetter
|
||||
-->
|
||||
|
||||
<persistence
|
||||
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
|
||||
version="2.1">
|
||||
|
||||
<persistence-unit name="LibreCCM" transaction-type="JTA">
|
||||
|
||||
<!--
|
||||
Enforce JPA provider
|
||||
Not really necessary here because we don't use any Hibernate
|
||||
specific features, but makes it easier to manage to database
|
||||
creation scripts.
|
||||
-->
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
|
||||
<jta-data-source>java:/comp/env/jdbc/org/libreccm/ccm-docrepo/pgsql</jta-data-source>
|
||||
<properties>
|
||||
<property name="hibernate.hbm2ddl.auto" value=""/>
|
||||
<property name="hibernate.show_sql" value="true"/>
|
||||
<property name="hibernate.id.new_generator_mappings" value="true"/>
|
||||
<property name="hibernate.connection.autocommit" value="false" />
|
||||
|
||||
<!--
|
||||
Properties for Hibernate Envers
|
||||
We are using the ValidityAuditStrategy here because it is faster
|
||||
when querying data than the DefaultStrategy
|
||||
-->
|
||||
<property name="org.hibernate.envers.audit_strategy"
|
||||
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
DELETE FROM ccm_core.settings_big_decimal;
|
||||
|
||||
DELETE FROM ccm_core.settings_boolean;
|
||||
|
||||
DELETE FROM ccm_core.settings_double;
|
||||
|
||||
DELETE FROM ccm_core.settings_enum_values;
|
||||
|
||||
DELETE FROM ccm_core.settings_enum;
|
||||
|
||||
DELETE FROM ccm_core.settings_l10n_string;
|
||||
|
||||
DELETE FROM ccm_core.settings_l10n_str_values;
|
||||
|
||||
DELETE FROM ccm_core.settings_long;
|
||||
|
||||
DELETE FROM ccm_core.settings_string;
|
||||
|
||||
DELETE FROM ccm_core.settings;
|
||||
|
||||
DELETE FROM ccm_core.categorizations;
|
||||
|
||||
DELETE FROM ccm_core.category_domains;
|
||||
|
||||
DELETE FROM ccm_core.categories;
|
||||
|
||||
DELETE FROM ccm_core.permissions;
|
||||
|
||||
DELETE FROM ccm_core.ccm_objects;
|
||||
|
||||
DELETE FROM ccm_core.role_memberships;
|
||||
|
||||
DELETE FROM ccm_core.group_memberships;
|
||||
|
||||
DELETE FROM ccm_core.groups;
|
||||
|
||||
DELETE FROM ccm_core.users;
|
||||
|
||||
DELETE FROM ccm_core.user_email_addresses;
|
||||
|
||||
DELETE FROM ccm_core.parties;
|
||||
|
||||
DELETE FROM ccm_core.ccm_roles;
|
||||
|
||||
DELETE FROM ccm_core.one_time_auth_tokens;
|
||||
|
||||
ALTER SEQUENCE hibernate_sequence RESTART WITH 1;
|
||||
Loading…
Reference in New Issue