Migrated integration tests in shortcuts to failsafe plugin
parent
0b59bcb232
commit
82fb581163
|
|
@ -60,7 +60,6 @@ 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>
|
||||
|
|
@ -117,7 +116,7 @@ public class ContentItemRepositoryIT {
|
|||
return ShrinkWrap
|
||||
.create(WebArchive.class,
|
||||
"LibreCCM-org.librecms.contentsection.ContentItemRepositoryTest.war")
|
||||
.addPackages(true, "com.arsdigita", "org.libreccm", "org.librecms")
|
||||
.addPackages(true, "com.arsdigita", "org.libreccm", "org.librecms")
|
||||
.addAsLibraries(getCcmCoreDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -970,7 +970,6 @@
|
|||
<testResource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</testResource>
|
||||
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
|
|
|
|||
|
|
@ -290,7 +290,7 @@
|
|||
<linkXref>true</linkXref>
|
||||
<sourceEncoding>utf-8</sourceEncoding>
|
||||
<targetJdk>1.8</targetJdk>
|
||||
<!-- <rulesets>
|
||||
<!-- <rulesets>
|
||||
<ruleset>/rulesets/java/basic.xml</ruleset>
|
||||
<ruleset>/rulesets/java/braces.xml</ruleset>
|
||||
<ruleset>/rulesets/java/clone.xml</ruleset>
|
||||
|
|
@ -340,6 +340,330 @@
|
|||
</reporting>
|
||||
|
||||
<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>
|
||||
<id>wildfly-managed-h2-mem</id>
|
||||
<dependencies>
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@
|
|||
*/
|
||||
package org.libreccm.shortcuts;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
|
|
@ -31,10 +29,11 @@ import javax.persistence.Id;
|
|||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
import javax.persistence.Table;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* Entity representing a single shortcut.
|
||||
*
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@Entity
|
||||
|
|
@ -46,8 +45,8 @@ import javax.persistence.Table;
|
|||
@NamedQuery(
|
||||
name = "Shortcut.findByRedirect",
|
||||
query = "SELECT s FROM Shortcut s "
|
||||
+ "WHERE s.redirect = :redirect "
|
||||
+ "ORDER BY s.urlKey")
|
||||
+ "WHERE s.redirect = :redirect "
|
||||
+ "ORDER BY s.urlKey")
|
||||
})
|
||||
public class Shortcut implements Serializable {
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public class ShortcutRepository extends AbstractEntityRepository<Long, Shortcut>
|
|||
private static final Logger LOGGER = LogManager.getLogger(
|
||||
ShortcutRepository.class);
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public Class<Shortcut> getEntityClass() {
|
||||
return Shortcut.class;
|
||||
|
|
|
|||
|
|
@ -52,14 +52,22 @@ public class DatasetsTest extends DatasetsVerifier {
|
|||
super(datasetPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetType getDatasetType() {
|
||||
return DatasetType.FLAT_XML;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSchemas() {
|
||||
return new String[]{"ccm_core", "ccm_shortcuts"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetType getDatasetType() {
|
||||
return DatasetType.FLAT_XML;
|
||||
public String[] getDdlFiles() {
|
||||
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
|
||||
|
|
|
|||
|
|
@ -47,10 +47,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.security.Shiro;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
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>
|
||||
*/
|
||||
@Category(IntegrationTest.class)
|
||||
@RunWith(Arquillian.class)
|
||||
@PersistenceTest
|
||||
@Transactional(TransactionMode.COMMIT)
|
||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
||||
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||
@CreateSchema(
|
||||
{
|
||||
"001_create_schema.sql",
|
||||
"002_create_ccm_shortcuts_tables.sql",
|
||||
"003_init_hibernate_sequence.sql"
|
||||
}
|
||||
)
|
||||
@CleanupUsingScript(value = {"999_cleanup.sql"},
|
||||
phase = TestExecutionPhase.BEFORE)
|
||||
public class ShortcutManagerTest {
|
||||
public class ShortcutManagerIT {
|
||||
|
||||
@Inject
|
||||
private ShortcutManager shortcutManager;
|
||||
|
|
@ -77,10 +80,10 @@ public class ShortcutManagerTest {
|
|||
@Inject
|
||||
private Subject subject;
|
||||
|
||||
@PersistenceContext
|
||||
@PersistenceContext(name = "LibreCCM")
|
||||
private EntityManager entityManager;
|
||||
|
||||
public ShortcutManagerTest() {
|
||||
public ShortcutManagerIT() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
|
|
@ -104,27 +107,7 @@ public class ShortcutManagerTest {
|
|||
return ShrinkWrap.create(
|
||||
WebArchive.class,
|
||||
"LibreCCM-org.libreccm.shortcuts.ShortcutTest-web.war")
|
||||
.addPackage(org.libreccm.auditing.CcmRevision.class.getPackage())
|
||||
.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)
|
||||
.addPackages(true, "com.arsdigita", "org.libreccm")
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsLibraries(getCcmCoreDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
|
|
@ -150,7 +133,8 @@ public class ShortcutManagerTest {
|
|||
@UsingDataSet(
|
||||
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||
value
|
||||
= "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||
excludeColumns = {"shortcut_id"})
|
||||
@InSequence(100)
|
||||
public void createShortcutBySystemUser() {
|
||||
|
|
@ -168,7 +152,8 @@ public class ShortcutManagerTest {
|
|||
@UsingDataSet(
|
||||
"datasets/org/libreccm/shortcuts/ShortcutManagerTest/data.xml")
|
||||
@ShouldMatchDataSet(
|
||||
value = "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||
value
|
||||
= "datasets/org/libreccm/shortcuts/ShortcutManagerTest/after-create.xml",
|
||||
excludeColumns = {"shortcut_id"})
|
||||
@InSequence(110)
|
||||
public void createShortcutByAuthorizedUser() {
|
||||
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
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.junit.Arquillian;
|
||||
|
|
@ -26,6 +26,7 @@ import org.jboss.arquillian.junit.InSequence;
|
|||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||
import org.jboss.arquillian.persistence.CreateSchema;
|
||||
import org.jboss.arquillian.persistence.PersistenceTest;
|
||||
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||
import org.jboss.arquillian.persistence.UsingDataSet;
|
||||
import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
|
||||
import org.jboss.arquillian.transaction.api.annotation.Transactional;
|
||||
|
|
@ -38,7 +39,6 @@ import org.junit.Before;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.libreccm.tests.categories.IntegrationTest;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
|
@ -46,31 +46,40 @@ 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.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.equalTo;
|
||||
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>
|
||||
*/
|
||||
@org.junit.experimental.categories.Category(IntegrationTest.class)
|
||||
@RunWith(Arquillian.class)
|
||||
@PersistenceTest
|
||||
@Transactional(TransactionMode.COMMIT)
|
||||
@CreateSchema({"create_ccm_shortcuts_schema.sql"})
|
||||
@CleanupUsingScript(value = {"cleanup.sql"},
|
||||
phase = TestExecutionPhase.BEFORE)
|
||||
public class ShortcutRepositoryTest {
|
||||
@CreateSchema(
|
||||
{
|
||||
"001_create_schema.sql",
|
||||
"002_create_ccm_shortcuts_tables.sql",
|
||||
"003_init_hibernate_sequence.sql"
|
||||
}
|
||||
)
|
||||
@CleanupUsingScript(
|
||||
value = {"999_cleanup.sql"},
|
||||
phase = TestExecutionPhase.BEFORE
|
||||
)
|
||||
public class ShortcutRepositoryIT {
|
||||
|
||||
@Inject
|
||||
private ShortcutRepository shortcutRepository;
|
||||
|
||||
@PersistenceContext
|
||||
@PersistenceContext(name = "LibreCCM")
|
||||
private EntityManager entityManager;
|
||||
|
||||
public ShortcutRepositoryTest() {
|
||||
public ShortcutRepositoryIT() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
|
|
@ -91,31 +100,17 @@ public class ShortcutRepositoryTest {
|
|||
|
||||
@Deployment
|
||||
public static WebArchive createDeployment() {
|
||||
return ShrinkWrap.create(
|
||||
WebArchive.class,
|
||||
"LibreCCM-org.libreccm.shortcuts.ShortcutRepositoryTest-web.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.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())
|
||||
return ShrinkWrap
|
||||
.create(
|
||||
WebArchive.class,
|
||||
"LibreCCM-org.libreccm.shortcuts.ShortcutRepositoryTest-web.war"
|
||||
)
|
||||
.addPackages(true, "com.arsdigita", "org.libreccm")
|
||||
//.addAsLibraries(getModuleDependencies())
|
||||
.addAsLibraries(getCcmCoreDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
.addAsResource(
|
||||
"test-persistence.xml", "META-INF/persistence.xml"
|
||||
)
|
||||
.addAsWebInfResource("test-web.xml", "WEB-INF/web.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 (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
|
|
@ -552,11 +542,11 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|||
SETTING_ID bigint not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_DOUBLE double,
|
||||
SETTING_VALUE_LONG bigint,
|
||||
SETTING_VALUE_BIG_DECIMAL decimal(19,2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1297,9 +1287,9 @@ create sequence hibernate_sequence start with 1 increment by 1;
|
|||
references CCM_CORE.STYLE_RULES;
|
||||
|
||||
alter table CCM_CORE.STYLE_RULES
|
||||
add constraint FKf6fb4k6y2d74p70ldmj8awqj3
|
||||
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||
foreign key (STYLE_ID)
|
||||
references CCM_CORE.STYLE_MEDIA_RULES;
|
||||
references CCM_CORE.STYLES;
|
||||
|
||||
alter table CCM_CORE.THEME_DATA_FILES
|
||||
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;
|
||||
|
||||
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.connection.autocommit" value="false" />
|
||||
|
||||
<property name="wildfly.jpa.hibernate.search.module"
|
||||
value="org.hibernate.search.orm:main" />
|
||||
|
||||
|
||||
<!--
|
||||
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"/>-->
|
||||
<property name="org.hibernate.envers.audit_strategy"
|
||||
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
|
||||
</properties>
|
||||
</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 (
|
||||
APPLICATION_TYPE varchar(1024) not null,
|
||||
|
|
@ -552,11 +542,11 @@ DROP SEQUENCE IF EXISTS hibernate_sequence;
|
|||
SETTING_ID int8 not null,
|
||||
CONFIGURATION_CLASS varchar(512) not null,
|
||||
NAME varchar(512) not null,
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_DOUBLE float8,
|
||||
SETTING_VALUE_LONG int8,
|
||||
SETTING_VALUE_BIG_DECIMAL numeric(19, 2),
|
||||
SETTING_VALUE_STRING varchar(1024),
|
||||
SETTING_VALUE_BOOLEAN boolean,
|
||||
primary key (SETTING_ID)
|
||||
);
|
||||
|
||||
|
|
@ -1297,9 +1287,9 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
references CCM_CORE.STYLE_RULES;
|
||||
|
||||
alter table CCM_CORE.STYLE_RULES
|
||||
add constraint FKf6fb4k6y2d74p70ldmj8awqj3
|
||||
add constraint FKcbr0k93g001jix7i4kncsce1w
|
||||
foreign key (STYLE_ID)
|
||||
references CCM_CORE.STYLE_MEDIA_RULES;
|
||||
references CCM_CORE.STYLES;
|
||||
|
||||
alter table CCM_CORE.THEME_DATA_FILES
|
||||
add constraint FK630m2y2p7pp487ofowbefrm89
|
||||
|
|
@ -1424,4 +1414,4 @@ create sequence hibernate_sequence start 1 increment 1;
|
|||
alter table CCM_CORE.WORKFLOWS
|
||||
add constraint FK9ray5beiny6wm2mi0uwyecay2
|
||||
foreign key (TEMPLATE_ID)
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
references CCM_CORE.WORKFLOWS;
|
||||
|
|
@ -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;
|
||||
|
||||
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.StringReader;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -149,7 +151,7 @@ public class DatasetsVerifier {
|
|||
switch (getDatasetType()) {
|
||||
case FLAT_XML:
|
||||
final FlatXmlDataSetBuilder builder
|
||||
= new FlatXmlDataSetBuilder();
|
||||
= new FlatXmlDataSetBuilder();
|
||||
dataSet = builder.build(inputStream);
|
||||
break;
|
||||
case JSON:
|
||||
|
|
@ -167,7 +169,7 @@ public class DatasetsVerifier {
|
|||
|
||||
//Create DBUnit DB connection
|
||||
final IDatabaseConnection dbUnitConn
|
||||
= new DatabaseConnection(connection);
|
||||
= new DatabaseConnection(connection);
|
||||
dbUnitConn.getConfig().setProperty(
|
||||
"http://www.dbunit.org/features/qualifiedTableNames", true);
|
||||
//Check if dumping works the DB works before loading the dataset.
|
||||
|
|
@ -187,12 +189,17 @@ public class DatasetsVerifier {
|
|||
return new String[]{"/sql/ddl/auto/h2.sql"};
|
||||
}
|
||||
|
||||
private void processDdlFile(final Connection connection,
|
||||
final String ddlFile) throws URISyntaxException,
|
||||
SQLException,
|
||||
IOException {
|
||||
final Path schemaPath = Paths.get(getClass().getResource(ddlFile)
|
||||
.toURI());
|
||||
private void processDdlFile(
|
||||
final Connection connection, final String ddlFile)
|
||||
throws URISyntaxException, SQLException, IOException {
|
||||
final URL resource = Objects.requireNonNull(
|
||||
getClass().getResource(ddlFile),
|
||||
String.format(
|
||||
"Failed to get DDL file: %s,",
|
||||
ddlFile
|
||||
)
|
||||
);
|
||||
final Path schemaPath = Paths.get(resource.toURI());
|
||||
RunScript.execute(connection,
|
||||
Files.newBufferedReader(schemaPath,
|
||||
StandardCharsets.UTF_8));
|
||||
|
|
|
|||
Loading…
Reference in New Issue