parent
8ad4189222
commit
16ed009114
|
|
@ -60,7 +60,6 @@ import static org.hamcrest.CoreMatchers.not;
|
||||||
import static org.hamcrest.CoreMatchers.nullValue;
|
import static org.hamcrest.CoreMatchers.nullValue;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
|
|
|
||||||
|
|
@ -970,7 +970,6 @@
|
||||||
<testResource>
|
<testResource>
|
||||||
<directory>${project.build.directory}/generated-resources</directory>
|
<directory>${project.build.directory}/generated-resources</directory>
|
||||||
</testResource>
|
</testResource>
|
||||||
|
|
||||||
</testResources>
|
</testResources>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
||||||
|
|
@ -340,6 +340,330 @@
|
||||||
</reporting>
|
</reporting>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>run-its-with-wildfly-h2mem</id>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wildfly.arquillian</groupId>
|
||||||
|
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</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-h2-mem</directory>
|
||||||
|
</testResource>
|
||||||
|
<testResource>
|
||||||
|
<directory>${project.build.directory}/generated-resources</directory>
|
||||||
|
</testResource>
|
||||||
|
</testResources>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>de.jpdigital</groupId>
|
||||||
|
<artifactId>hibernate53-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-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<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>
|
||||||
|
<trimStackTrace>false</trimStackTrace>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wildfly.plugins</groupId>
|
||||||
|
<artifactId>wildfly-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>false</skip>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<configuration>
|
||||||
|
<stdout>System.out</stdout>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>add-resource</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<configuration>
|
||||||
|
<address>subsystem=datasources,data-source=ccm-shortcuts-testdb</address>
|
||||||
|
<force>true</force>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<properties>
|
||||||
|
<connection-url>jdbc:h2:mem:ccm-shortcuts-testdb</connection-url>
|
||||||
|
<jndi-name>java:/comp/env/jdbc/org/libreccm/ccm-shortcuts/h2-mem</jndi-name>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<user-name>sa</user-name>
|
||||||
|
<password>sa</password>
|
||||||
|
<use-ccm>false</use-ccm>
|
||||||
|
<driver-name>h2</driver-name>
|
||||||
|
</properties>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>shutdown-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>shutdown</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||||
|
<reportSets>
|
||||||
|
<reportSet>
|
||||||
|
<id>integration-tests</id>
|
||||||
|
<reports>
|
||||||
|
<report>failsafe-report-only</report>
|
||||||
|
</reports>
|
||||||
|
</reportSet>
|
||||||
|
</reportSets>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>run-its-with-wildfly-pgsql</id>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wildfly.arquillian</groupId>
|
||||||
|
<artifactId>wildfly-arquillian-container-remote</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.sf.saxon</groupId>
|
||||||
|
<artifactId>Saxon-HE</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</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>hibernate53-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-failsafe-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<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>
|
||||||
|
<trimStackTrace>false</trimStackTrace>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>properties-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>read-datasource-properties</id>
|
||||||
|
<phase>initialize</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>read-project-properties</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<files>
|
||||||
|
<file>${project.basedir}/../it-pgsql-datasources.properties</file>
|
||||||
|
</files>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wildfly.plugins</groupId>
|
||||||
|
<artifactId>wildfly-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>false</skip>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>start-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>start</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<configuration>
|
||||||
|
<stdout>System.out</stdout>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-deploy-jdbc-driver</id>
|
||||||
|
<configuration>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<name>postgresql.jar</name>
|
||||||
|
<force>true</force>
|
||||||
|
</configuration>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>deploy-artifact</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>prepare-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>add-resource</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>pre-integration-test</phase>
|
||||||
|
<configuration>
|
||||||
|
<address>subsystem=datasources,data-source=ccm-shortcuts-testdb-pgsql</address>
|
||||||
|
<force>true</force>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<properties>
|
||||||
|
<connection-url>${it.ccm-shortcuts.datasource.connectionUrl}</connection-url>
|
||||||
|
<jndi-name>java:/comp/env/jdbc/org/libreccm/ccm-shortcuts/pgsql</jndi-name>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
<user-name>${it.ccm-shortcuts.datasource.username}</user-name>
|
||||||
|
<password>${it.ccm-shortcuts.datasource.password}</password>
|
||||||
|
<use-ccm>false</use-ccm>
|
||||||
|
<driver-name>postgresql.jar</driver-name>
|
||||||
|
</properties>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>shutdown-test-env</id>
|
||||||
|
<goals>
|
||||||
|
<goal>shutdown</goal>
|
||||||
|
</goals>
|
||||||
|
<phase>post-integration-test</phase>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-report-plugin</artifactId>
|
||||||
|
<reportSets>
|
||||||
|
<reportSet>
|
||||||
|
<id>integration-tests</id>
|
||||||
|
<reports>
|
||||||
|
<report>failsafe-report-only</report>
|
||||||
|
</reports>
|
||||||
|
</reportSet>
|
||||||
|
</reportSets>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
</profile>
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>wildfly-managed-h2-mem</id>
|
<id>wildfly-managed-h2-mem</id>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.shortcuts;
|
package org.libreccm.shortcuts;
|
||||||
|
|
||||||
import org.hibernate.validator.constraints.NotEmpty;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
|
@ -31,6 +29,7 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.NamedQueries;
|
import javax.persistence.NamedQueries;
|
||||||
import javax.persistence.NamedQuery;
|
import javax.persistence.NamedQuery;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entity representing a single shortcut.
|
* Entity representing a single shortcut.
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,8 @@ public class ShortcutRepository extends AbstractEntityRepository<Long, Shortcut>
|
||||||
private static final Logger LOGGER = LogManager.getLogger(
|
private static final Logger LOGGER = LogManager.getLogger(
|
||||||
ShortcutRepository.class);
|
ShortcutRepository.class);
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<Shortcut> getEntityClass() {
|
public Class<Shortcut> getEntityClass() {
|
||||||
return Shortcut.class;
|
return Shortcut.class;
|
||||||
|
|
|
||||||
|
|
@ -52,14 +52,22 @@ public class DatasetsTest extends DatasetsVerifier {
|
||||||
super(datasetPath);
|
super(datasetPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DatasetType getDatasetType() {
|
||||||
|
return DatasetType.FLAT_XML;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String[] getSchemas() {
|
public String[] getSchemas() {
|
||||||
return new String[]{"ccm_core", "ccm_shortcuts"};
|
return new String[]{"ccm_core", "ccm_shortcuts"};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatasetType getDatasetType() {
|
public String[] getDdlFiles() {
|
||||||
return DatasetType.FLAT_XML;
|
return new String[]{
|
||||||
|
"/scripts/datasets-test/001_create_schema.sql",
|
||||||
|
"/scripts/datasets-test/002_create_ccm_shortcuts_tables.sql",
|
||||||
|
"/scripts/datasets-test/003_init_hibernate_sequence.sql",};
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,8 @@ import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.libreccm.security.Shiro;
|
import org.libreccm.security.Shiro;
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
@ -59,14 +57,19 @@ import static org.junit.Assert.*;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@Category(IntegrationTest.class)
|
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
@CreateSchema(
|
||||||
@CleanupUsingScript(value = {"cleanup.sql"},
|
{
|
||||||
|
"001_create_schema.sql",
|
||||||
|
"002_create_ccm_shortcuts_tables.sql",
|
||||||
|
"003_init_hibernate_sequence.sql"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@CleanupUsingScript(value = {"999_cleanup.sql"},
|
||||||
phase = TestExecutionPhase.BEFORE)
|
phase = TestExecutionPhase.BEFORE)
|
||||||
public class ShortcutManagerTest {
|
public class ShortcutManagerIT {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ShortcutManager shortcutManager;
|
private ShortcutManager shortcutManager;
|
||||||
|
|
@ -77,10 +80,10 @@ public class ShortcutManagerTest {
|
||||||
@Inject
|
@Inject
|
||||||
private Subject subject;
|
private Subject subject;
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext(name = "LibreCCM")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
public ShortcutManagerTest() {
|
public ShortcutManagerIT() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
@ -104,27 +107,7 @@ public class ShortcutManagerTest {
|
||||||
return ShrinkWrap.create(
|
return ShrinkWrap.create(
|
||||||
WebArchive.class,
|
WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.shortcuts.ShortcutTest-web.war")
|
"LibreCCM-org.libreccm.shortcuts.ShortcutTest-web.war")
|
||||||
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
|
.addPackages(true, "com.arsdigita", "org.libreccm")
|
||||||
.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.CcmCore.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.jpa.EntityManagerProducer.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.tests.categories.IntegrationTest.class
|
|
||||||
.getPackage())
|
|
||||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
|
||||||
.addClass(org.libreccm.imexport.Exportable.class)
|
|
||||||
.addClass(org.libreccm.shortcuts.Shortcut.class)
|
|
||||||
.addClass(org.libreccm.shortcuts.ShortcutManager.class)
|
|
||||||
.addClass(org.libreccm.shortcuts.ShortcutRepository.class)
|
|
||||||
.addAsLibraries(getModuleDependencies())
|
.addAsLibraries(getModuleDependencies())
|
||||||
.addAsLibraries(getCcmCoreDependencies())
|
.addAsLibraries(getCcmCoreDependencies())
|
||||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||||
|
|
@ -150,7 +133,8 @@ public class ShortcutManagerTest {
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
value = "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
value
|
||||||
|
= "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||||
excludeColumns = {"shortcut_id"})
|
excludeColumns = {"shortcut_id"})
|
||||||
@InSequence(100)
|
@InSequence(100)
|
||||||
public void createShortcutBySystemUser() {
|
public void createShortcutBySystemUser() {
|
||||||
|
|
@ -168,7 +152,8 @@ public class ShortcutManagerTest {
|
||||||
@UsingDataSet(
|
@UsingDataSet(
|
||||||
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
||||||
@ShouldMatchDataSet(
|
@ShouldMatchDataSet(
|
||||||
value = "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
value
|
||||||
|
= "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||||
excludeColumns = {"shortcut_id"})
|
excludeColumns = {"shortcut_id"})
|
||||||
@InSequence(110)
|
@InSequence(110)
|
||||||
public void createShortcutByAuthorizedUser() {
|
public void createShortcutByAuthorizedUser() {
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
*/
|
*/
|
||||||
package org.libreccm.shortcuts;
|
package org.libreccm.shortcuts;
|
||||||
|
|
||||||
import static org.libreccm.testutils.DependenciesHelpers.*;
|
import static org.libreccm.testutils.DependenciesHelpers.getCcmCoreDependencies;
|
||||||
|
|
||||||
import org.jboss.arquillian.container.test.api.Deployment;
|
import org.jboss.arquillian.container.test.api.Deployment;
|
||||||
import org.jboss.arquillian.junit.Arquillian;
|
import org.jboss.arquillian.junit.Arquillian;
|
||||||
|
|
@ -26,6 +26,7 @@ import org.jboss.arquillian.junit.InSequence;
|
||||||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||||
import org.jboss.arquillian.persistence.CreateSchema;
|
import org.jboss.arquillian.persistence.CreateSchema;
|
||||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
import org.jboss.arquillian.persistence.PersistenceTest;
|
||||||
|
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||||
import org.jboss.arquillian.persistence.UsingDataSet;
|
import org.jboss.arquillian.persistence.UsingDataSet;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
||||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
||||||
|
|
@ -38,7 +39,6 @@ import org.junit.Before;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.libreccm.tests.categories.IntegrationTest;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
@ -46,31 +46,40 @@ import java.util.Optional;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.equalTo;
|
||||||
import static org.junit.Assert.*;
|
import static org.hamcrest.CoreMatchers.is;
|
||||||
|
import static org.hamcrest.CoreMatchers.not;
|
||||||
|
import static org.hamcrest.CoreMatchers.nullValue;
|
||||||
|
import static org.junit.Assert.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||||
*/
|
*/
|
||||||
@org.junit.experimental.categories.Category(IntegrationTest.class)
|
|
||||||
@RunWith(Arquillian.class)
|
@RunWith(Arquillian.class)
|
||||||
@PersistenceTest
|
@PersistenceTest
|
||||||
@Transactional(TransactionMode.COMMIT)
|
@Transactional(TransactionMode.COMMIT)
|
||||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
@CreateSchema(
|
||||||
@CleanupUsingScript(value = {"cleanup.sql"},
|
{
|
||||||
phase = TestExecutionPhase.BEFORE)
|
"001_create_schema.sql",
|
||||||
public class ShortcutRepositoryTest {
|
"002_create_ccm_shortcuts_tables.sql",
|
||||||
|
"003_init_hibernate_sequence.sql"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
@CleanupUsingScript(
|
||||||
|
value = {"999_cleanup.sql"},
|
||||||
|
phase = TestExecutionPhase.BEFORE
|
||||||
|
)
|
||||||
|
public class ShortcutRepositoryIT {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ShortcutRepository shortcutRepository;
|
private ShortcutRepository shortcutRepository;
|
||||||
|
|
||||||
@PersistenceContext
|
@PersistenceContext(name = "LibreCCM")
|
||||||
private EntityManager entityManager;
|
private EntityManager entityManager;
|
||||||
|
|
||||||
public ShortcutRepositoryTest() {
|
public ShortcutRepositoryIT() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
|
|
@ -91,31 +100,17 @@ public class ShortcutRepositoryTest {
|
||||||
|
|
||||||
@Deployment
|
@Deployment
|
||||||
public static WebArchive createDeployment() {
|
public static WebArchive createDeployment() {
|
||||||
return ShrinkWrap.create(
|
return ShrinkWrap
|
||||||
|
.create(
|
||||||
WebArchive.class,
|
WebArchive.class,
|
||||||
"LibreCCM-org.libreccm.shortcuts.ShortcutRepositoryTest-web.war")
|
"LibreCCM-org.libreccm.shortcuts.ShortcutRepositoryTest-web.war"
|
||||||
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
|
)
|
||||||
.addPackage(org.libreccm.categorization.Categorization.class
|
.addPackages(true, "com.arsdigita", "org.libreccm")
|
||||||
.getPackage())
|
//.addAsLibraries(getModuleDependencies())
|
||||||
.addPackage(org.libreccm.configuration.Configuration.class
|
|
||||||
.getPackage())
|
|
||||||
.addPackage(org.libreccm.core.CcmCore.class.getPackage())
|
|
||||||
.addPackage(org.libreccm.jpa.EntityManagerProducer.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.tests.categories.IntegrationTest.class
|
|
||||||
.getPackage())
|
|
||||||
.addClass(org.libreccm.imexport.Exportable.class)
|
|
||||||
.addClass(org.libreccm.shortcuts.Shortcut.class)
|
|
||||||
.addClass(org.libreccm.shortcuts.ShortcutRepository.class)
|
|
||||||
.addAsLibraries(getModuleDependencies())
|
|
||||||
.addAsLibraries(getCcmCoreDependencies())
|
.addAsLibraries(getCcmCoreDependencies())
|
||||||
.addAsResource("test-persistence.xml",
|
.addAsResource(
|
||||||
"META-INF/persistence.xml")
|
"test-persistence.xml", "META-INF/persistence.xml"
|
||||||
|
)
|
||||||
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
.addAsWebInfResource("test-web.xml", "WEB-INF/web.xml")
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
DROP SCHEMA IF EXISTS ccm_shortcuts CASCADE;
|
||||||
|
DROP SCHEMA IF EXISTS ccm_core CASCADE;
|
||||||
|
|
||||||
|
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
|
|
||||||
|
create schema CCM_CORE;
|
||||||
|
|
||||||
|
create schema CCM_SHORTCUTS;
|
||||||
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
DROP SCHEMA IF EXISTS ccm_shortcuts CASCADE;
|
|
||||||
DROP SCHEMA IF EXISTS ccm_core CASCADE;
|
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|
||||||
|
|
||||||
|
|
||||||
create schema CCM_CORE;
|
|
||||||
|
|
||||||
create schema CCM_SHORTCUTS;
|
|
||||||
|
|
||||||
|
|
||||||
create table CCM_CORE.APPLICATIONS (
|
create table CCM_CORE.APPLICATIONS (
|
||||||
APPLICATION_TYPE varchar(1024) not null,
|
APPLICATION_TYPE varchar(1024) not null,
|
||||||
|
|
@ -552,11 +542,11 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
SETTING_ID bigint not null,
|
SETTING_ID bigint not null,
|
||||||
CONFIGURATION_CLASS varchar(512) not null,
|
CONFIGURATION_CLASS varchar(512) not null,
|
||||||
NAME varchar(512) not null,
|
NAME varchar(512) not null,
|
||||||
|
SETTING_VALUE_BOOLEAN boolean,
|
||||||
|
SETTING_VALUE_STRING varchar(1024),
|
||||||
SETTING_VALUE_DOUBLE double,
|
SETTING_VALUE_DOUBLE double,
|
||||||
SETTING_VALUE_LONG bigint,
|
SETTING_VALUE_LONG bigint,
|
||||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||||
SETTING_VALUE_STRING varchar(1024),
|
|
||||||
SETTING_VALUE_BOOLEAN boolean,
|
|
||||||
primary key (SETTING_ID)
|
primary key (SETTING_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1297,9 +1287,9 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
||||||
references CCM_CORE.STYLE_RULES;
|
references CCM_CORE.STYLE_RULES;
|
||||||
|
|
||||||
alter table CCM_CORE.STYLE_RULES
|
alter table CCM_CORE.STYLE_RULES
|
||||||
add constraint FKf6fb4k6y2d74p70ldmj8awqj3
|
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||||
foreign key (STYLE_ID)
|
foreign key (STYLE_ID)
|
||||||
references CCM_CORE.STYLE_MEDIA_RULES;
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
alter table CCM_CORE.THEME_DATA_FILES
|
alter table CCM_CORE.THEME_DATA_FILES
|
||||||
add constraint FK630m2y2p7pp487ofowbefrm89
|
add constraint FK630m2y2p7pp487ofowbefrm89
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER SEQUENCE hibernate_sequence RESTART WITH 100000;
|
||||||
|
|
||||||
|
|
@ -36,4 +36,4 @@ DELETE FROM ccm_core.parties;
|
||||||
|
|
||||||
DELETE FROM ccm_core.ccm_roles;
|
DELETE FROM ccm_core.ccm_roles;
|
||||||
|
|
||||||
ALTER SEQUENCE hibernate_sequence RESTART;
|
ALTER SEQUENCE hibernate_sequence RESTART WITH 100000;
|
||||||
|
|
@ -27,13 +27,17 @@
|
||||||
<property name="hibernate.id.new_generator_mappings" value="true"/>
|
<property name="hibernate.id.new_generator_mappings" value="true"/>
|
||||||
<property name="hibernate.connection.autocommit" value="false" />
|
<property name="hibernate.connection.autocommit" value="false" />
|
||||||
|
|
||||||
|
<property name="wildfly.jpa.hibernate.search.module"
|
||||||
|
value="org.hibernate.search.orm:main" />
|
||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Properties for Hibernate Envers
|
Properties for Hibernate Envers
|
||||||
We are using the ValidityAuditStrategy here because it is faster
|
We are using the ValidityAuditStrategy here because it is faster
|
||||||
when querying data than the DefaultStrategy
|
when querying data than the DefaultStrategy
|
||||||
-->
|
-->
|
||||||
<!--<property name="org.hibernate.envers.audit_strategy"
|
<property name="org.hibernate.envers.audit_strategy"
|
||||||
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>-->
|
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
|
||||||
</properties>
|
</properties>
|
||||||
</persistence-unit>
|
</persistence-unit>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
DROP SCHEMA IF EXISTS ccm_shortcuts CASCADE;
|
||||||
|
DROP SCHEMA IF EXISTS ccm_core CASCADE;
|
||||||
|
|
||||||
|
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
|
|
||||||
|
create schema CCM_CORE;
|
||||||
|
|
||||||
|
create schema CCM_SHORTCUTS;
|
||||||
|
|
||||||
|
|
@ -1,13 +1,3 @@
|
||||||
DROP SCHEMA IF EXISTS ccm_shortcuts CASCADE;
|
|
||||||
DROP SCHEMA IF EXISTS ccm_core CASCADE;
|
|
||||||
|
|
||||||
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|
||||||
|
|
||||||
|
|
||||||
create schema CCM_CORE;
|
|
||||||
|
|
||||||
create schema CCM_SHORTCUTS;
|
|
||||||
|
|
||||||
|
|
||||||
create table CCM_CORE.APPLICATIONS (
|
create table CCM_CORE.APPLICATIONS (
|
||||||
APPLICATION_TYPE varchar(1024) not null,
|
APPLICATION_TYPE varchar(1024) not null,
|
||||||
|
|
@ -552,11 +542,11 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
SETTING_ID int8 not null,
|
SETTING_ID int8 not null,
|
||||||
CONFIGURATION_CLASS varchar(512) not null,
|
CONFIGURATION_CLASS varchar(512) not null,
|
||||||
NAME varchar(512) not null,
|
NAME varchar(512) not null,
|
||||||
|
SETTING_VALUE_BOOLEAN boolean,
|
||||||
|
SETTING_VALUE_STRING varchar(1024),
|
||||||
SETTING_VALUE_DOUBLE float8,
|
SETTING_VALUE_DOUBLE float8,
|
||||||
SETTING_VALUE_LONG int8,
|
SETTING_VALUE_LONG int8,
|
||||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||||
SETTING_VALUE_STRING varchar(1024),
|
|
||||||
SETTING_VALUE_BOOLEAN boolean,
|
|
||||||
primary key (SETTING_ID)
|
primary key (SETTING_ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -1297,9 +1287,9 @@ create sequence hibernate_sequence start 1 increment 1;
|
||||||
references CCM_CORE.STYLE_RULES;
|
references CCM_CORE.STYLE_RULES;
|
||||||
|
|
||||||
alter table CCM_CORE.STYLE_RULES
|
alter table CCM_CORE.STYLE_RULES
|
||||||
add constraint FKf6fb4k6y2d74p70ldmj8awqj3
|
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||||
foreign key (STYLE_ID)
|
foreign key (STYLE_ID)
|
||||||
references CCM_CORE.STYLE_MEDIA_RULES;
|
references CCM_CORE.STYLES;
|
||||||
|
|
||||||
alter table CCM_CORE.THEME_DATA_FILES
|
alter table CCM_CORE.THEME_DATA_FILES
|
||||||
add constraint FK630m2y2p7pp487ofowbefrm89
|
add constraint FK630m2y2p7pp487ofowbefrm89
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER SEQUENCE hibernate_sequence RESTART WITH 100000;
|
||||||
|
|
||||||
|
|
@ -36,4 +36,4 @@ DELETE FROM ccm_core.parties;
|
||||||
|
|
||||||
DELETE FROM ccm_core.ccm_roles;
|
DELETE FROM ccm_core.ccm_roles;
|
||||||
|
|
||||||
ALTER SEQUENCE hibernate_sequence RESTART WITH 1;
|
ALTER SEQUENCE hibernate_sequence RESTART WITH 100000;
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
DROP SCHEMA IF EXISTS ccm_shortcuts CASCADE;
|
||||||
|
DROP SCHEMA IF EXISTS ccm_core CASCADE;
|
||||||
|
|
||||||
|
DROP SEQUENCE IF EXISTS hibernate_sequence;
|
||||||
|
|
||||||
|
create schema CCM_CORE;
|
||||||
|
|
||||||
|
create schema CCM_SHORTCUTS;
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER SEQUENCE hibernate_sequence RESTART WITH 100000;
|
||||||
|
|
||||||
|
|
@ -47,7 +47,9 @@ import org.jboss.arquillian.persistence.dbunit.dataset.yaml.YamlDataSet;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -187,12 +189,17 @@ public class DatasetsVerifier {
|
||||||
return new String[]{"/sql/ddl/auto/h2.sql"};
|
return new String[]{"/sql/ddl/auto/h2.sql"};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processDdlFile(final Connection connection,
|
private void processDdlFile(
|
||||||
final String ddlFile) throws URISyntaxException,
|
final Connection connection, final String ddlFile)
|
||||||
SQLException,
|
throws URISyntaxException, SQLException, IOException {
|
||||||
IOException {
|
final URL resource = Objects.requireNonNull(
|
||||||
final Path schemaPath = Paths.get(getClass().getResource(ddlFile)
|
getClass().getResource(ddlFile),
|
||||||
.toURI());
|
String.format(
|
||||||
|
"Failed to get DDL file: %s,",
|
||||||
|
ddlFile
|
||||||
|
)
|
||||||
|
);
|
||||||
|
final Path schemaPath = Paths.get(resource.toURI());
|
||||||
RunScript.execute(connection,
|
RunScript.execute(connection,
|
||||||
Files.newBufferedReader(schemaPath,
|
Files.newBufferedReader(schemaPath,
|
||||||
StandardCharsets.UTF_8));
|
StandardCharsets.UTF_8));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue