parent
04789fd327
commit
7d3475a480
|
|
@ -333,7 +333,7 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!-- <dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>oracle12c</param>
|
||||
<param>postgresql9</param>
|
||||
|
|
@ -660,11 +660,15 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
<param>oracle12c</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
@ -742,10 +746,14 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
@ -824,10 +832,14 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
@ -901,10 +913,14 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
@ -982,10 +998,14 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
@ -1059,10 +1079,14 @@
|
|||
<groupId>de.jpdigital</groupId>
|
||||
<artifactId>hibernate53-ddl-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<dialects>
|
||||
<!-- <dialects>
|
||||
<param>h2</param>
|
||||
<param>postgresql9</param>
|
||||
</dialects>
|
||||
</dialects>-->
|
||||
<customDialects>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmH2Dialect</param>
|
||||
<param>org.libreccm.hibernate.dialects.LibreCcmPgSql9Dialect</param>
|
||||
</customDialects>
|
||||
<packages>
|
||||
<param>org.libreccm</param>
|
||||
</packages>
|
||||
|
|
|
|||
|
|
@ -43,13 +43,10 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
|||
import org.hibernate.annotations.Type;
|
||||
import org.libreccm.imexport.Exportable;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedAttributeNode;
|
||||
import javax.persistence.NamedEntityGraph;
|
||||
|
|
@ -164,14 +161,6 @@ public class Category extends CcmObject implements Serializable, Exportable {
|
|||
/**
|
||||
* The human readable and localisable title of the category.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "CATEGORY_TITLES",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}
|
||||
// ))
|
||||
@Column(name = "TITLE")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
@XmlElement(name = "title", namespace = CAT_XML_NS)
|
||||
|
|
@ -180,14 +169,6 @@ public class Category extends CcmObject implements Serializable, Exportable {
|
|||
/**
|
||||
* A localisable description of the category.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "CATEGORY_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}
|
||||
// ))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
@XmlElement(name = "description", namespace = CAT_XML_NS)
|
||||
|
|
|
|||
|
|
@ -49,12 +49,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedAttributeNode;
|
||||
import javax.persistence.NamedEntityGraph;
|
||||
|
|
@ -161,13 +158,6 @@ public class Domain extends CcmObject implements Serializable, Exportable {
|
|||
* A human readable title for the {@code Domain}. The title can be
|
||||
* localised.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "DOMAIN_TITLES",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}))
|
||||
@Column(name = "TITLE")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
@XmlElement(name = "title", namespace = CAT_XML_NS)
|
||||
|
|
@ -176,13 +166,6 @@ public class Domain extends CcmObject implements Serializable, Exportable {
|
|||
/**
|
||||
* A description of the domain. The description can be localised.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "DOMAIN_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
@XmlElement(name = "description", namespace = CAT_XML_NS)
|
||||
|
|
|
|||
|
|
@ -41,13 +41,6 @@ public class LocalizedStringSetting
|
|||
|
||||
private static final long serialVersionUID = 667750736151545279L;
|
||||
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "SETTINGS_L10N_STR_VALUES",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "ENTRY_ID")}))
|
||||
@Column(name = "SETTING_VALUE_LOCALIZED_STRING")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString value;
|
||||
|
|
|
|||
|
|
@ -38,13 +38,9 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
|
@ -83,13 +79,6 @@ public class Resource extends CcmObject implements Serializable, Exportable {
|
|||
/**
|
||||
* A localisable title for the {@code Resource}.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "RESOURCE_TITLES",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}))
|
||||
@Column(name = "TITLE")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString title;
|
||||
|
|
@ -97,13 +86,6 @@ public class Resource extends CcmObject implements Serializable, Exportable {
|
|||
/**
|
||||
* A localisable description for the {@code Resource}.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "RESOURCE_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "OBJECT_ID")}))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -84,13 +84,6 @@ public class ResourceType implements Serializable, Exportable {
|
|||
@Column(name = "TITLE", length = 254, nullable = false)
|
||||
private String title;
|
||||
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "RESOURCE_TYPE_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "RESOURCE_TYPE_ID")}))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -53,13 +53,6 @@ public class Component extends CcmObject implements Serializable {
|
|||
@Column(name = "ADMIN_NAME")
|
||||
private String adminName;
|
||||
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "FORMBUILDER_COMPONENT_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "COMPONENT_ID")}))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -34,9 +34,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
|
|
@ -46,7 +44,6 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
|
@ -226,14 +223,6 @@ public class PageModel implements Serializable {
|
|||
* The localised title of this {@code PageModel} (shown in the
|
||||
* administration UI),
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "PAGE_MODEL_TITLES",
|
||||
// schema = CoreConstants.DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "PAGE_MODEL_ID")
|
||||
// }))
|
||||
@Column(name = "TITLE")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString title;
|
||||
|
|
@ -241,14 +230,6 @@ public class PageModel implements Serializable {
|
|||
/**
|
||||
* A description of this {@code PageModel} describing its purpose.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "PAGE_MODEL_DESCRIPTIONS",
|
||||
// schema = CoreConstants.DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "PAGE_MODEL_ID")
|
||||
// }))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -183,14 +183,6 @@ public class Role implements Serializable, Exportable {
|
|||
/**
|
||||
* An optional description for a role.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "ROLE_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "ROLE_ID")
|
||||
// }))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
@XmlElement(name = "description", namespace = CORE_XML_NS)
|
||||
|
|
|
|||
|
|
@ -38,9 +38,7 @@ import static org.libreccm.core.CoreConstants.DB_SCHEMA;
|
|||
|
||||
import org.hibernate.annotations.Type;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
|
|
@ -51,7 +49,6 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
|
@ -149,13 +146,6 @@ public class Task implements Identifiable, Serializable {
|
|||
/**
|
||||
* A human readable, localisable label for the task.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "WORKFLOW_TASK_LABELS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "TASK_ID")}))
|
||||
@Column(name = "LABEL")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString label;
|
||||
|
|
@ -163,13 +153,6 @@ public class Task implements Identifiable, Serializable {
|
|||
/**
|
||||
* A description of the task.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "WORKFLOW_TASK_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "TASK_ID")}))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description;
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ import org.libreccm.core.CcmObject;
|
|||
import org.libreccm.core.Identifiable;
|
||||
import org.libreccm.l10n.LocalizedString;
|
||||
|
||||
import javax.persistence.AssociationOverride;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embedded;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EnumType;
|
||||
import javax.persistence.Enumerated;
|
||||
|
|
@ -39,7 +37,6 @@ import javax.persistence.Id;
|
|||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.NamedQueries;
|
||||
import javax.persistence.NamedQuery;
|
||||
|
|
@ -117,13 +114,6 @@ public class Workflow implements Identifiable, Serializable, Exportable {
|
|||
/**
|
||||
* Human readable name of the workflow.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "WORKFLOW_NAMES",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "WORKFLOW_ID")}))
|
||||
@Column(name = "NAME")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString name = new LocalizedString();
|
||||
|
|
@ -131,14 +121,6 @@ public class Workflow implements Identifiable, Serializable, Exportable {
|
|||
/**
|
||||
* Description of the workflow.
|
||||
*/
|
||||
// @Embedded
|
||||
// @AssociationOverride(
|
||||
// name = "values",
|
||||
// joinTable = @JoinTable(name = "WORKFLOW_DESCRIPTIONS",
|
||||
// schema = DB_SCHEMA,
|
||||
// joinColumns = {
|
||||
// @JoinColumn(name = "WORKFLOW_ID")
|
||||
// }))
|
||||
@Column(name = "DESCRIPTION")
|
||||
@Type(type = "org.libreccm.l10n.LocalizedStringType")
|
||||
private LocalizedString description = new LocalizedString();
|
||||
|
|
|
|||
|
|
@ -70,8 +70,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)
|
||||
|
|
@ -147,6 +147,12 @@ public class CategoryManagerTest {
|
|||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
@ -397,8 +403,7 @@ public class CategoryManagerTest {
|
|||
@UsingDataSet("datasets/org/libreccm/categorization/CategoryManagerTest"
|
||||
+ "/data.yml")
|
||||
@ShouldMatchDataSet(
|
||||
excludeColumns = {
|
||||
},
|
||||
excludeColumns = {},
|
||||
value = "datasets/org/libreccm/categorization/CategoryManagerTest"
|
||||
+ "/after-remove-obj-from-category.yml"
|
||||
)
|
||||
|
|
@ -751,7 +756,7 @@ public class CategoryManagerTest {
|
|||
/**
|
||||
* 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 {@link CategoryManager#getIndexObject(org.libreccm.categorization.Category).
|
||||
*/
|
||||
@Test
|
||||
@UsingDataSet(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -133,6 +133,12 @@ public class CategoryRepositoryTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
@ -250,7 +256,7 @@ public class CategoryRepositoryTest {
|
|||
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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,8 +62,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)
|
||||
|
|
@ -124,6 +124,12 @@ public class ConfigurationManagerTest {
|
|||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -67,8 +67,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)
|
||||
|
|
@ -105,15 +105,21 @@ public class CcmObjectRepositoryTest {
|
|||
.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.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)
|
||||
|
|
@ -122,17 +128,26 @@ public class CcmObjectRepositoryTest {
|
|||
.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.security.PermissionChecker.class.getPackage()
|
||||
)
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
|
||||
getPackage())
|
||||
.addPackage(org.libreccm.tests.categories.IntegrationTest.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.security.SecurityConfig.class
|
||||
.getPackage())
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
@ -358,7 +373,8 @@ public class CcmObjectRepositoryTest {
|
|||
@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);
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ import static org.junit.Assert.*;
|
|||
@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)
|
||||
|
|
@ -82,20 +82,26 @@ public class GroupImportTest {
|
|||
private static final String IMPORT_MANIFEST_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupImportTest"
|
||||
+ "/ccm-export.json";
|
||||
|
||||
private static final String IMPORT_GROUPS_TOC_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupImportTest"
|
||||
+ "/org.libreccm.security.Group"
|
||||
+ "/org.libreccm.security.Group.json";
|
||||
|
||||
private static final String IMPORT_DATA_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupImportTest"
|
||||
+ "/org.libreccm.security.Group"
|
||||
+ "/696592cd-db19-4aca-bb14-06490cfde243.json";
|
||||
|
||||
private static final String TMP_DIR = System.getProperty("java.io.tmpdir");
|
||||
|
||||
private static final String CCM_TESTS_DIR = TMP_DIR + "/ccm-tests";
|
||||
|
||||
private static final String IMPORTS_DIR = CCM_TESTS_DIR + "/imports";
|
||||
|
||||
private static final String GROUP_IMPORT_TEST_DIR = IMPORTS_DIR
|
||||
+ "/org.libreccm.imexport.GroupImportTest";
|
||||
|
||||
private static final String IMPORT_DATA_DIR = GROUP_IMPORT_TEST_DIR
|
||||
+ "/org.libreccm.security.Group";
|
||||
|
||||
|
|
@ -233,6 +239,12 @@ public class GroupImportTest {
|
|||
.getPackage())
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("imports", "imports")
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ import static org.junit.Assert.*;
|
|||
@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)
|
||||
|
|
@ -82,23 +82,29 @@ public class GroupMembershipImportTest {
|
|||
private static final String IMPORT_MANIFEST_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupMembershipImportTest"
|
||||
+ "/ccm-export.json";
|
||||
|
||||
private static final String IMPORT_GROUPMEMBERSHIP_TOC_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupMembershipImportTest"
|
||||
+ "/org.libreccm.security.GroupMembership"
|
||||
+ "/org.libreccm.security.GroupMembership.json";
|
||||
|
||||
private static final String IMPORT_GROUPMEMBERSHIP_DATA_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.GroupMembershipImportTest"
|
||||
+ "/org.libreccm.security.GroupMembership"
|
||||
+ "/f8ac4073-447e-4bd6-ac96-3bf92bdc8ce7.json";
|
||||
|
||||
private static final String TMP_DIR = System.getProperty("java.io.tmpdir");
|
||||
|
||||
private static final String CCM_TESTS_DIR = TMP_DIR + "/ccm-tests";
|
||||
|
||||
private static final String IMPORTS_DIR = CCM_TESTS_DIR + "/imports";
|
||||
|
||||
private static final String GROUPMEMBERSHIP_IMPORT_TEST_DIR = IMPORTS_DIR
|
||||
+ "/org.libreccm.imexport.GroupMembershipImportTest";
|
||||
|
||||
private static final String IMPORT_GROUPMEMBERSHIP_DATA_DIR
|
||||
= GROUPMEMBERSHIP_IMPORT_TEST_DIR
|
||||
+ "/org.libreccm.security.GroupMembership";
|
||||
= GROUPMEMBERSHIP_IMPORT_TEST_DIR
|
||||
+ "/org.libreccm.security.GroupMembership";
|
||||
|
||||
@Inject
|
||||
private ConfigurationManager confManager;
|
||||
|
|
@ -157,7 +163,7 @@ public class GroupMembershipImportTest {
|
|||
final Path groupMembershipsTocTargetPath = importGroupMembershipDataPath
|
||||
.resolve("org.libreccm.security.GroupMembership.json");
|
||||
final Path groupMembership1DataTargetPath
|
||||
= importGroupMembershipDataPath
|
||||
= importGroupMembershipDataPath
|
||||
.resolve("f8ac4073-447e-4bd6-ac96-3bf92bdc8ce7.json");
|
||||
|
||||
copy(manifestInputStream, manifestTargetPath);
|
||||
|
|
@ -237,6 +243,12 @@ public class GroupMembershipImportTest {
|
|||
.getPackage())
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("imports", "imports")
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ import static org.junit.Assert.*;
|
|||
@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)
|
||||
|
|
@ -82,20 +82,26 @@ public class UserImportTest {
|
|||
private static final String IMPORT_MANIFEST_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.UserImportTest"
|
||||
+ "/ccm-export.json";
|
||||
|
||||
private static final String IMPORT_USERS_TOC_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.UserImportTest"
|
||||
+ "/org.libreccm.security.User"
|
||||
+ "/org.libreccm.security.User.json";
|
||||
|
||||
private static final String IMPORT_DATA_SOURCE = "/imports"
|
||||
+ "/org.libreccm.imexport.UserImportTest"
|
||||
+ "/org.libreccm.security.User"
|
||||
+ "/7cb9aba4-8071-4f27-af19-096e1473d050.json";
|
||||
|
||||
private static final String TMP_DIR = System.getProperty("java.io.tmpdir");
|
||||
|
||||
private static final String CCM_TESTS_DIR = TMP_DIR + "/ccm-tests";
|
||||
|
||||
private static final String IMPORTS_DIR = CCM_TESTS_DIR + "/imports";
|
||||
|
||||
private static final String USER_IMPORT_TEST_DIR = IMPORTS_DIR
|
||||
+ "/org.libreccm.imexport.UserImportTest";
|
||||
|
||||
private static final String IMPORT_DATA_DIR = USER_IMPORT_TEST_DIR
|
||||
+ "/org.libreccm.security.User";
|
||||
|
||||
|
|
@ -232,6 +238,12 @@ public class UserImportTest {
|
|||
.getPackage())
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("imports", "imports")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@ import static org.libreccm.testutils.DependenciesHelpers.*;
|
|||
import org.jboss.arquillian.persistence.CleanupUsingScript;
|
||||
import org.jboss.arquillian.persistence.TestExecutionPhase;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
|
|
@ -55,8 +54,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)
|
||||
|
|
@ -102,6 +101,12 @@ public class ConfigurationLoaderTest {
|
|||
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
|
||||
getPackage())
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class DatasetsTest extends DatasetsVerifier {
|
|||
@Parameterized.Parameters(name = "Dataset {0}")
|
||||
public static Collection<String> data() {
|
||||
return Arrays.asList(new String[]{
|
||||
"/datasets/org/libreccm/modules/ConfigurationLoaderTest/after-load.x,l",});
|
||||
"/datasets/org/libreccm/modules/ConfigurationLoaderTest/after-load.xml",});
|
||||
}
|
||||
|
||||
public DatasetsTest(final String datasetPath) {
|
||||
|
|
|
|||
|
|
@ -113,6 +113,12 @@ public class DependencyTreeManagerCycleTest {
|
|||
org.libreccm.modules.dependencytree.test.cycle.TestModuleC.class)
|
||||
.addPackage(org.libreccm.pagemodel.PageModel.class.getPackage())
|
||||
.addClass(org.libreccm.web.ApplicationType.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
|
||||
.addAsResource(
|
||||
|
|
|
|||
|
|
@ -127,6 +127,12 @@ public class DependencyTreeManagerTest {
|
|||
// .addClass(org.libreccm.portation.Portable.class)
|
||||
.addPackage(org.libreccm.pagemodel.PageModel.class.getPackage())
|
||||
.addClass(org.libreccm.web.ApplicationType.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
|
||||
.addAsResource(
|
||||
|
|
|
|||
|
|
@ -133,6 +133,12 @@ public class AuthorizationInterceptorTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.util.UncheckedWrapperException.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -136,6 +136,12 @@ public class ChallengeManagerTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ public class GroupManagerTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ public class GroupRepositoryTest {
|
|||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -130,6 +130,12 @@ public class OneTimeAuthManagerTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addClass(com.arsdigita.kernel.security.SecurityConfig.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -131,6 +131,12 @@ public class PartyRepositoryTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -134,6 +134,12 @@ public class PermissionCheckerTest {
|
|||
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -135,6 +135,12 @@ public class PermissionManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -123,6 +123,12 @@ public class RoleManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -132,6 +132,12 @@ public class RoleRepositoryTest {
|
|||
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
|
||||
.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -149,6 +149,12 @@ public class SecuredCollectionTest {
|
|||
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
|
||||
.addPackage(com.arsdigita.kernel.security.SecurityConfig.class
|
||||
.getPackage())
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -152,6 +152,12 @@ public class SecuredIteratorTest {
|
|||
.getPackage())
|
||||
.addPackage(com.arsdigita.kernel.KernelConfig.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -125,6 +125,12 @@ public class ShiroTest {
|
|||
.getPackage())
|
||||
.addClass(org.libreccm.security.authorization.LabBean.class)
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ public class UserManagerTest {
|
|||
.getPackage())
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("test-persistence.xml",
|
||||
"META-INF/persistence.xml")
|
||||
|
|
|
|||
|
|
@ -131,6 +131,12 @@ public class UserRepositoryTest {
|
|||
.addClass(com.arsdigita.kernel.KernelConfig.class)
|
||||
.addPackage(org.libreccm.cdi.utils.CdiUtil.class.getPackage())
|
||||
.addClass(org.libreccm.imexport.Exportable.class)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory.class
|
||||
)
|
||||
.addClass(
|
||||
org.libreccm.testutils.dbunit.PgSqlJsonbType.class
|
||||
)
|
||||
.addAsLibraries(getModuleDependencies())
|
||||
.addAsResource("configs/shiro.ini", "shiro.ini")
|
||||
.addAsResource("test-persistence.xml",
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<extension qualifier="persistence-dbunit">
|
||||
<property name="defaultDataSetFormat">json</property>
|
||||
<property name="datatypeFactory">org.dbunit.ext.h2.H2DataTypeFactory</property>
|
||||
<property name="datatypeFactory">org.libreccm.testutils.dbunit.CcmH2DataTypeFactory</property>
|
||||
<property name="excludePoi">true</property>
|
||||
<property name="qualifiedTableNames">true</property>
|
||||
</extension>
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
<extension qualifier="persistence-dbunit">
|
||||
<property name="defaultDataSetFormat">json</property>
|
||||
<property name="datatypeFactory">org.dbunit.ext.postgresql.PostgresqlDataTypeFactory</property>
|
||||
<property name="datatypeFactory">org.libreccm.testutils.dbunit.CcmPgSqlDataTypeFactory</property>
|
||||
<property name="excludePoi">true</property>
|
||||
<property name="qualifiedTableNames">true</property>
|
||||
</extension>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
DELETE FROM ccm_core.settings_string_list;
|
||||
|
||||
DELETE FROM ccm_core.settings_l10n_str_values;
|
||||
|
||||
DELETE FROM ccm_core.settings_enum_values;
|
||||
|
||||
DELETE FROM ccm_core.settings_enum_values;
|
||||
|
|
|
|||
|
|
@ -1,31 +0,0 @@
|
|||
ccm_core.settings:
|
||||
- dtype: LocalizedStringSetting
|
||||
setting_id: 120
|
||||
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||
name: title
|
||||
setting_value_long: null
|
||||
setting_value_localized_string: "{\"de\": \"Versuch\", \"en\": \"Test\"}"
|
||||
setting_value_double: null
|
||||
setting_value_string: null
|
||||
setting_value_big_decimal: null
|
||||
setting_value_boolean: null
|
||||
- dtype: BooleanSetting
|
||||
setting_id: 100
|
||||
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||
name: enabled
|
||||
setting_value_long: null
|
||||
setting_value_localized_string: null
|
||||
setting_value_double: null
|
||||
setting_value_string: null
|
||||
setting_value_big_decimal: null
|
||||
setting_value_boolean: true
|
||||
- dtype: LongSetting
|
||||
setting_id: 110
|
||||
configuration_class: org.libreccm.configuration.ExampleConfiguration
|
||||
name: itemsPerPage
|
||||
setting_value_long: 100
|
||||
setting_value_localized_string: null
|
||||
setting_value_double: null
|
||||
setting_value_string: null
|
||||
setting_value_big_decimal: null
|
||||
setting_value_boolean: null
|
||||
|
|
@ -44,6 +44,11 @@
|
|||
<artifactId>h2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jboss.arquillian.extension</groupId>
|
||||
<artifactId>arquillian-persistence-dbunit</artifactId>
|
||||
|
|
@ -151,7 +156,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>
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ import org.junit.runners.Parameterized;
|
|||
|
||||
import static org.libreccm.testutils.DatasetType.*;
|
||||
|
||||
import org.dbunit.database.DatabaseConfig;
|
||||
import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
|
||||
import org.jboss.arquillian.persistence.dbunit.dataset.yaml.YamlDataSet;
|
||||
import org.libreccm.testutils.dbunit.CcmH2DataTypeFactory;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
|
|
@ -77,38 +77,39 @@ import java.sql.ResultSet;
|
|||
*/
|
||||
public class DatasetsVerifier {
|
||||
|
||||
private final String datasetPath;
|
||||
private final String datasetPath;
|
||||
|
||||
public DatasetsVerifier(final String datasetsPath) {
|
||||
this.datasetPath = datasetsPath;
|
||||
}
|
||||
public DatasetsVerifier(final String datasetsPath) {
|
||||
this.datasetPath = datasetsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrite this method if you are using another schema than the default one.
|
||||
*
|
||||
* @return An string array contains the names of the database schemata used by
|
||||
* the datasets the test.
|
||||
*/
|
||||
public String[] getSchemas() {
|
||||
return new String[]{};
|
||||
}
|
||||
/**
|
||||
* Overwrite this method if you are using another schema than the default
|
||||
* one.
|
||||
*
|
||||
* @return An string array contains the names of the database schemata used
|
||||
* by the datasets the test.
|
||||
*/
|
||||
public String[] getSchemas() {
|
||||
return new String[]{};
|
||||
}
|
||||
|
||||
public DatasetType getDatasetType() {
|
||||
return JSON;
|
||||
}
|
||||
public DatasetType getDatasetType() {
|
||||
return JSON;
|
||||
}
|
||||
|
||||
@Test
|
||||
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
|
||||
value = "DMI_EMPTY_DB_PASSWORD",
|
||||
justification = "H2 in mem database does not need a password")
|
||||
public void verifyDataset() throws SQLException,
|
||||
URISyntaxException,
|
||||
IOException,
|
||||
DatabaseUnitException {
|
||||
//Create database connection to an in memory h2 database. Placed in
|
||||
//try-with-resources block to ensure that the connection is closed.
|
||||
final StringBuffer buffer = new StringBuffer("jdbc:h2:mem:testdatabase");
|
||||
//Create schema if necssary
|
||||
@Test
|
||||
@edu.umd.cs.findbugs.annotations.SuppressWarnings(
|
||||
value = "DMI_EMPTY_DB_PASSWORD",
|
||||
justification = "H2 in mem database does not need a password")
|
||||
public void verifyDataset() throws SQLException,
|
||||
URISyntaxException,
|
||||
IOException,
|
||||
DatabaseUnitException {
|
||||
//Create database connection to an in memory h2 database. Placed in
|
||||
//try-with-resources block to ensure that the connection is closed.
|
||||
final StringBuffer buffer = new StringBuffer("jdbc:h2:mem:testdatabase");
|
||||
//Create schema if necssary
|
||||
// if (getSchemas().length > 0) {
|
||||
// buffer.append(";INIT=");
|
||||
// for (final String schema : getSchemas()) {
|
||||
|
|
@ -119,122 +120,95 @@ public void verifyDataset() throws SQLException,
|
|||
// schema));
|
||||
// }
|
||||
// }
|
||||
final String connectionStr = buffer.toString();
|
||||
try (final Connection connection = DriverManager
|
||||
.getConnection(connectionStr, "sa", "")) {
|
||||
final StringBuffer schemaCreateBuffer = new StringBuffer();
|
||||
for (final String schema : getSchemas()) {
|
||||
schemaCreateBuffer.append(String
|
||||
.format("CREATE SCHEMA IF NOT EXISTS %s;%n", schema));
|
||||
}
|
||||
final String connectionStr = buffer.toString();
|
||||
try (final Connection connection = DriverManager
|
||||
.getConnection(connectionStr, "sa", "")) {
|
||||
final StringBuffer schemaCreateBuffer = new StringBuffer();
|
||||
for (final String schema : getSchemas()) {
|
||||
schemaCreateBuffer.append(String
|
||||
.format("CREATE SCHEMA IF NOT EXISTS %s;%n", schema));
|
||||
}
|
||||
|
||||
try (final StringReader schemaCreateReader = new StringReader(
|
||||
schemaCreateBuffer.toString())) {
|
||||
RunScript.execute(connection, schemaCreateReader);
|
||||
}
|
||||
try (final StringReader schemaCreateReader = new StringReader(
|
||||
schemaCreateBuffer.toString())) {
|
||||
RunScript.execute(connection, schemaCreateReader);
|
||||
}
|
||||
|
||||
//Create DB tables etc
|
||||
for (final String ddlFile : getDdlFiles()) {
|
||||
processDdlFile(connection, ddlFile);
|
||||
}
|
||||
//Create DB tables etc
|
||||
for (final String ddlFile : getDdlFiles()) {
|
||||
processDdlFile(connection, ddlFile);
|
||||
}
|
||||
|
||||
// final Path schemaPath = Paths.get(getClass().getResource(
|
||||
// "/sql/ddl/auto/h2.sql").toURI());
|
||||
// RunScript.execute(connection, Files.newBufferedReader(
|
||||
// schemaPath, StandardCharsets.UTF_8));
|
||||
connection.commit();
|
||||
connection.commit();
|
||||
|
||||
System.out.println("DB Info:");
|
||||
System.out.println("Catalogs:");
|
||||
try (ResultSet resultSet = connection.getMetaData().getCatalogs()) {
|
||||
while(resultSet.next()) {
|
||||
System.out.println(resultSet.getString("table_cat"));
|
||||
//Get dataset to test
|
||||
final IDataSet dataSet;
|
||||
try (final InputStream inputStream = getClass().getResourceAsStream(
|
||||
datasetPath)) {
|
||||
switch (getDatasetType()) {
|
||||
case FLAT_XML:
|
||||
final FlatXmlDataSetBuilder builder
|
||||
= new FlatXmlDataSetBuilder();
|
||||
dataSet = builder.build(inputStream);
|
||||
break;
|
||||
case JSON:
|
||||
dataSet = new JsonDataSet(inputStream);
|
||||
break;
|
||||
case YAML:
|
||||
dataSet = new YamlDataSet(inputStream);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Unsupported DatasetType \"%s\"",
|
||||
getDatasetType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Schemas");
|
||||
try(ResultSet resultSet = connection.getMetaData().getSchemas()) {
|
||||
while(resultSet.next()) {
|
||||
System.out.println(resultSet.getString("TABLE_SCHEM"));
|
||||
}
|
||||
}
|
||||
System.out.println("Tables");
|
||||
try (ResultSet resultSet = connection.getMetaData().getTables("TESTDATABASE", "CCM_CORE", null, null)) {
|
||||
while(resultSet.next()) {
|
||||
System.out.println(resultSet.getString("table_name"));
|
||||
}
|
||||
}
|
||||
System.out.println("settings columns:");
|
||||
try (ResultSet resultSet = connection.getMetaData().getColumns(
|
||||
"TESTDATABASE", "CCM_CORE", "SETTINGS", null
|
||||
)) {
|
||||
while (resultSet.next()) {
|
||||
System.out.printf("table_name = %s%n", resultSet.getString(
|
||||
"table_name"));
|
||||
System.out.printf("col_name = %s%n", resultSet.getString(
|
||||
"column_name"));
|
||||
}
|
||||
}
|
||||
|
||||
//Get dataset to test
|
||||
final IDataSet dataSet;
|
||||
try (final InputStream inputStream = getClass().getResourceAsStream(
|
||||
datasetPath)) {
|
||||
switch (getDatasetType()) {
|
||||
case FLAT_XML:
|
||||
final FlatXmlDataSetBuilder builder
|
||||
= new FlatXmlDataSetBuilder();
|
||||
dataSet = builder.build(inputStream);
|
||||
break;
|
||||
case JSON:
|
||||
dataSet = new JsonDataSet(inputStream);
|
||||
break;
|
||||
case YAML:
|
||||
dataSet = new YamlDataSet(inputStream);
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Unsupported DatasetType \"%s\"",
|
||||
getDatasetType()));
|
||||
}
|
||||
//Create DBUnit DB connection
|
||||
final IDatabaseConnection dbUnitConn
|
||||
= new DatabaseConnection(connection);
|
||||
dbUnitConn.getConfig().setProperty(
|
||||
"http://www.dbunit.org/properties/datatypeFactory",
|
||||
new CcmH2DataTypeFactory()
|
||||
);
|
||||
dbUnitConn.getConfig().setProperty(
|
||||
"http://www.dbunit.org/features/qualifiedTableNames", true);
|
||||
//Check if dumping works the DB works before loading the dataset.
|
||||
System.out.println("Dump before loading dataset...");
|
||||
verifyDumping(dbUnitConn);
|
||||
|
||||
//Put dataset into DB
|
||||
DatabaseOperation.CLEAN_INSERT.execute(dbUnitConn, dataSet);
|
||||
|
||||
//Check if dumping works after loading the dataset
|
||||
System.out.println("Dump after loading dataset...");
|
||||
verifyDumping(dbUnitConn);
|
||||
}
|
||||
|
||||
//Create DBUnit DB connection
|
||||
final IDatabaseConnection dbUnitConn
|
||||
= new DatabaseConnection(connection);
|
||||
dbUnitConn.getConfig().setProperty(
|
||||
"http://www.dbunit.org/features/qualifiedTableNames", true);
|
||||
//Check if dumping works the DB works before loading the dataset.
|
||||
System.out.println("Dump before loading dataset...");
|
||||
verifyDumping(dbUnitConn);
|
||||
|
||||
//Put dataset into DB
|
||||
DatabaseOperation.CLEAN_INSERT.execute(dbUnitConn, dataSet);
|
||||
|
||||
//Check if dumping works after loading the dataset
|
||||
System.out.println("Dump after loading dataset...");
|
||||
verifyDumping(dbUnitConn);
|
||||
}
|
||||
}
|
||||
|
||||
protected String[] getDdlFiles() {
|
||||
return new String[]{"/sql/ddl/auto/libreccmh2.sql"};
|
||||
}
|
||||
protected String[] getDdlFiles() {
|
||||
return new String[]{"/sql/ddl/auto/libreccmh2.sql"};
|
||||
}
|
||||
|
||||
private void processDdlFile(final Connection connection,
|
||||
final String ddlFile) throws URISyntaxException,
|
||||
SQLException,
|
||||
IOException {
|
||||
final Path schemaPath = Paths.get(getClass().getResource(ddlFile)
|
||||
.toURI());
|
||||
RunScript.execute(connection,
|
||||
Files.newBufferedReader(schemaPath,
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
private void processDdlFile(final Connection connection,
|
||||
final String ddlFile) throws URISyntaxException,
|
||||
SQLException,
|
||||
IOException {
|
||||
final Path schemaPath = Paths.get(getClass().getResource(ddlFile)
|
||||
.toURI());
|
||||
RunScript.execute(connection,
|
||||
Files.newBufferedReader(schemaPath,
|
||||
StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private void verifyDumping(final IDatabaseConnection connection)
|
||||
throws SQLException, IOException, DataSetException {
|
||||
final IDataSet data = connection.createDataSet();
|
||||
FlatXmlDataSet.write(data, System.out);
|
||||
}
|
||||
private void verifyDumping(final IDatabaseConnection connection)
|
||||
throws SQLException, IOException, DataSetException {
|
||||
final IDataSet data = connection.createDataSet();
|
||||
FlatXmlDataSet.write(data, System.out);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.testutils.dbunit;
|
||||
|
||||
import org.dbunit.dataset.datatype.DataType;
|
||||
import org.dbunit.dataset.datatype.DataTypeException;
|
||||
import org.dbunit.ext.h2.H2DataTypeFactory;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class CcmH2DataTypeFactory extends H2DataTypeFactory {
|
||||
|
||||
@Override
|
||||
public DataType createDataType(final int sqlType, final String sqlTypeName)
|
||||
throws DataTypeException {
|
||||
if ("json".equals(sqlTypeName.toLowerCase(Locale.ROOT))) {
|
||||
return new H2JsonDataType();
|
||||
} else {
|
||||
return super.createDataType(sqlType, sqlTypeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.testutils.dbunit;
|
||||
|
||||
import org.dbunit.dataset.datatype.DataType;
|
||||
import org.dbunit.dataset.datatype.DataTypeException;
|
||||
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class CcmPgSqlDataTypeFactory extends PostgresqlDataTypeFactory {
|
||||
|
||||
@Override
|
||||
public DataType createDataType(
|
||||
final int sqlType, final String sqlTypeName
|
||||
) throws DataTypeException {
|
||||
if ("jsonb".equals(sqlTypeName.toLowerCase(Locale.ROOT))) {
|
||||
return new PgSqlJsonbType();
|
||||
} else {
|
||||
return super.createDataType(sqlType, sqlTypeName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.testutils.dbunit;
|
||||
|
||||
import org.dbunit.dataset.datatype.AbstractDataType;
|
||||
import org.dbunit.dataset.datatype.TypeCastException;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class H2JsonDataType extends AbstractDataType {
|
||||
|
||||
public H2JsonDataType() {
|
||||
super("json", Types.OTHER, String.class, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object typeCast(final Object value) throws TypeCastException {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSqlValue(final int column, final ResultSet resultSet)
|
||||
throws SQLException, TypeCastException {
|
||||
return resultSet.getString(column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSqlValue(
|
||||
final Object value,
|
||||
final int column,
|
||||
final PreparedStatement statement
|
||||
) throws SQLException, TypeCastException {
|
||||
statement.setObject(column, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2020 LibreCCM Foundation.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301 USA
|
||||
*/
|
||||
package org.libreccm.testutils.dbunit;
|
||||
|
||||
import org.dbunit.dataset.datatype.AbstractDataType;
|
||||
import org.dbunit.dataset.datatype.TypeCastException;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
public class PgSqlJsonbType extends AbstractDataType {
|
||||
|
||||
public PgSqlJsonbType() {
|
||||
super("jsonb", Types.OTHER, String.class, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object typeCast(final Object value) throws TypeCastException {
|
||||
return value.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getSqlValue(final int column, final ResultSet resultSet)
|
||||
throws SQLException, TypeCastException {
|
||||
return resultSet.getString(column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSqlValue(
|
||||
final Object value,
|
||||
final int column,
|
||||
final PreparedStatement statement
|
||||
) throws SQLException, TypeCastException {
|
||||
final PGobject jsonObj = new PGobject();
|
||||
jsonObj.setType("jsonb");
|
||||
if (value == null) {
|
||||
jsonObj.setValue(null);
|
||||
} else {
|
||||
jsonObj.setValue(value.toString());
|
||||
}
|
||||
|
||||
statement.setObject(column, jsonObj);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue