CCM NG: Files etc for testing ContentSectionManager
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@4198 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
1716a17093
commit
3747ea5fbe
|
|
@ -127,6 +127,22 @@
|
|||
<build>
|
||||
<finalName>ccm-cms</finalName>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>${project.build.directory}/generated-resources</directory>
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
@ -218,12 +234,6 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
|
|
@ -334,4 +344,6 @@
|
|||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
|
||||
</project>
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public class CmsConstants {
|
|||
public static final String PRIVILEGE_ADMINISTER_WORKFLOW = "administer_workflow";
|
||||
public static final String PRIVILEGE_ITEMS_APPROVE = "approve_items";
|
||||
public static final String PRIVILEGE_ITEMS_PUBLISH = "publish_items";
|
||||
public static final String PRIVILEGE_ITEMS_CATEGORIZE = "categories_items";
|
||||
public static final String PRIVILEGE_ITEMS_CATEGORIZE = "categorize_items";
|
||||
public static final String PRIVILEGE_ITEMS_CREATE_NEW = "create_new_items";
|
||||
public static final String PRIVILEGE_ITEMS_DELETE = "delete_items";
|
||||
public static final String PRIVILEGE_ITEMS_EDIT = "edit_items";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,85 @@
|
|||
/*
|
||||
* Copyright (C) 2016 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.librecms.contentsection;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.experimental.categories.Category;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.Parameterized;
|
||||
import org.libreccm.tests.categories.UnitTest;
|
||||
import org.libreccm.testutils.DatasetType;
|
||||
import org.libreccm.testutils.DatasetsVerifier;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
@Category(UnitTest.class)
|
||||
public class DatasetsTest extends DatasetsVerifier {
|
||||
|
||||
@Parameterized.Parameters(name = "Dataset {0}")
|
||||
public static Collection<String> data() {
|
||||
return Arrays.asList(new String[]{
|
||||
"/datasets/org/librecms/contentsection/ContentSectionManagerTest/data.xml"
|
||||
});
|
||||
}
|
||||
|
||||
public DatasetsTest(final String datasetPath) {
|
||||
super(datasetPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DatasetType getDatasetType() {
|
||||
return DatasetType.FLAT_XML;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getSchemas() {
|
||||
return new String[]{"ccm_core", "ccm_cms"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getDdlFiles() {
|
||||
return new String[]{"/datasets/create_ccm_cms_schema.sql"};
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() {
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<arquillian xmlns="http://jboss.org/schema/arquillian"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jboss.org/schema/arquillian
|
||||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd" >
|
||||
|
||||
<engine>
|
||||
<property name="deploymentExportPath">target/deployments</property>
|
||||
</engine>
|
||||
<defaultProtocol type="Servlet 3.0"/>
|
||||
<!--<property name="javaVmArguments">
|
||||
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
|
||||
</property>-->
|
||||
|
||||
<extension qualifier="persistence">
|
||||
<property name="defaultDataSource">java:/comp/env/jdbc/org/librecms/ccm-cms/h2-mem</property>
|
||||
|
||||
<!--
|
||||
Disable automatic cleanup, does not work because of referential
|
||||
integrity constrains.
|
||||
-->
|
||||
<property name="defaultCleanupPhase">NONE</property>
|
||||
|
||||
<property name="dumpData">true</property>
|
||||
<property name="dumpDirectory">target</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-dbunit">
|
||||
<property name="defaultDataSetFormat">json</property>
|
||||
<property name="datatypeFactory">org.dbunit.ext.h2.H2DataTypeFactory</property>
|
||||
<property name="excludePoi">true</property>
|
||||
<property name="qualifiedTableNames">true</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-script">
|
||||
<property name="scriptsToExecuteAfterTest">scripts/h2-cleanup.sql</property>
|
||||
</extension>
|
||||
|
||||
|
||||
</arquillian>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
author: Jens Pelzetter
|
||||
-->
|
||||
|
||||
<persistence
|
||||
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
|
||||
version="2.1">
|
||||
|
||||
<persistence-unit name="LibreCCM" transaction-type="JTA">
|
||||
|
||||
<!--
|
||||
Enforce JPA provider
|
||||
Not really necessary here because we don't use any Hibernate
|
||||
specific features, but makes it easier to manage to database
|
||||
creation scripts.
|
||||
-->
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
|
||||
<jta-data-source>java:/comp/env/jdbc/org/librecms/ccm-cms/h2-mem</jta-data-source>
|
||||
<properties>
|
||||
<property name="hibernate.hbm2ddl.auto" value=""/>
|
||||
<property name="hibernate.show_sql" value="true"/>
|
||||
<property name="hibernate.id.new_generator_mappings" value="true"/>
|
||||
<property name="hibernate.connection.autocommit" value="false" />
|
||||
|
||||
<!--
|
||||
Properties for Hibernate Envers
|
||||
We are using the ValidityAuditStrategy here because it is faster
|
||||
when querying data than the DefaultStrategy
|
||||
-->
|
||||
<property name="org.hibernate.envers.audit_strategy"
|
||||
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
||||
ccm-core/src/test/resources-wildfly8-remote-h2-mem/test-persistence.xml lines 1-40/40 (END)
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<arquillian xmlns="http://jboss.org/schema/arquillian"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://jboss.org/schema/arquillian
|
||||
http://jboss.org/schema/arquillian/arquillian_1_0.xsd" >
|
||||
|
||||
<engine>
|
||||
<property name="deploymentExportPath">target/deployments</property>
|
||||
</engine>
|
||||
|
||||
<extension qualifier="persistence">
|
||||
<property name="defaultDataSource">java:/comp/env/jdbc/org/librecms/ccm-cms/pgsql</property>
|
||||
<!--<property name="javaVmArguments">
|
||||
-Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
|
||||
</property>-->
|
||||
|
||||
<!--
|
||||
Disable automatic cleanup, does not work because of referential
|
||||
integrity constrains.
|
||||
-->
|
||||
<property name="defaultCleanupPhase">NONE</property>
|
||||
|
||||
<property name="dumpData">true</property>
|
||||
<property name="dumpDirectory">target</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-dbunit">
|
||||
<property name="defaultDataSetFormat">json</property>
|
||||
<!--<property name="datatypeFactory">org.dbunit.ext.h2.H2DataTypeFactory</property>-->
|
||||
<property name="excludePoi">true</property>
|
||||
<property name="qualifiedTableNames">true</property>
|
||||
</extension>
|
||||
|
||||
<extension qualifier="persistence-script">
|
||||
<property name="scriptsToExecuteAfterTest">scripts/pgsql-cleanup.sql</property>
|
||||
</extension>
|
||||
|
||||
|
||||
</arquillian>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
author: Jens Pelzetter
|
||||
-->
|
||||
|
||||
<persistence
|
||||
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
|
||||
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
|
||||
version="2.1">
|
||||
|
||||
<persistence-unit name="LibreCCM" transaction-type="JTA">
|
||||
|
||||
<!--
|
||||
Enforce JPA provider
|
||||
Not really necessary here because we don't use any Hibernate
|
||||
specific features, but makes it easier to manage to database
|
||||
creation scripts.
|
||||
-->
|
||||
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
|
||||
|
||||
<jta-data-source>java:/comp/env/jdbc/org/librecms/ccm-cms/pgsql</jta-data-source>
|
||||
<properties>
|
||||
<property name="hibernate.hbm2ddl.auto" value=""/>
|
||||
<property name="hibernate.show_sql" value="true"/>
|
||||
<property name="hibernate.id.new_generator_mappings" value="true"/>
|
||||
<property name="hibernate.connection.autocommit" value="false" />
|
||||
|
||||
<!--
|
||||
Properties for Hibernate Envers
|
||||
We are using the ValidityAuditStrategy here because it is faster
|
||||
when querying data than the DefaultStrategy
|
||||
-->
|
||||
<property name="org.hibernate.envers.audit_strategy"
|
||||
value="org.hibernate.envers.strategy.ValidityAuditStrategy"/>
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
|
||||
</persistence>
|
||||
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="DEBUG">
|
||||
<Appenders>
|
||||
<Console name="Console" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Root level="error">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Root>
|
||||
<Logger name="org.librecms.contentsection.ContentSectionManager"
|
||||
level="debug">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Logger>
|
||||
<Logger name="org.librecms.contentsection.ContentSectionRepository"
|
||||
level="debug">
|
||||
<AppenderRef ref="Console"/>
|
||||
</Logger>
|
||||
</Loggers>
|
||||
</Configuration>
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
[main]
|
||||
|
||||
passwordMatcher = org.apache.shiro.authc.credential.PasswordMatcher
|
||||
passwordService = org.apache.shiro.authc.credential.DefaultPasswordService
|
||||
passwordMatcher.passwordService = $passwordService
|
||||
|
||||
ccmRealm = org.libreccm.security.CcmShiroRealm
|
||||
ccmRealm.credentialsMatcher = $passwordMatcher
|
||||
|
||||
securityManager.realms = $ccmRealm
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,315 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<dataset>
|
||||
|
||||
<!--
|
||||
|
||||
Content Section info,
|
||||
CcmApplication
|
||||
Resource
|
||||
CcmObject
|
||||
|
||||
Root document folder category
|
||||
|
||||
Root assets folder category
|
||||
|
||||
Rollen:
|
||||
|
||||
info_alert_recipient
|
||||
|
||||
info_author: categorize_items, create_new_items, edit_items,
|
||||
view_published_items, preview_items
|
||||
|
||||
info_editor: categorize_items, create_new_items,, edit_items, approve_items,
|
||||
delete_items, view_published_items, preview_items
|
||||
|
||||
info_manager: administer_roles, administer_workflow, administer_lifecyles,
|
||||
administer_categories, administer_content_items,
|
||||
categorize_items, create_new_items, edit_items,
|
||||
approve_items, publish_items, delete-items,
|
||||
view_published_items, preview_items
|
||||
|
||||
info_publisher: categorize_items, create_new_items, edit_items,
|
||||
approve_items, publish_items, delete-items,
|
||||
view_published_items, preview_items
|
||||
|
||||
info_content_reader: view_published_items
|
||||
|
||||
-->
|
||||
|
||||
<ccm_core.ccm_objects object_id="-1100"
|
||||
display_name="info"
|
||||
uuid="963bcae7-3aeb-4b62-891c-e16c4defa1f2" />
|
||||
|
||||
<ccm_core.ccm_objects object_id="-2100"
|
||||
display_name="info_root"
|
||||
uuid="82014239-9c06-486d-ae8c-4ae47f52a699" />
|
||||
|
||||
<ccm_core.ccm_objects object_id="-2200"
|
||||
display_name="info_assets"
|
||||
uuid="b163f73c-9ac2-44d7-a037-de621f5ca828" />
|
||||
|
||||
<ccm_core.categories object_id="-2100"
|
||||
unique_id="82014239-9c06-486d-ae8c-4ae47f52a699"
|
||||
name="info_root"
|
||||
enabled="true"
|
||||
visible="true"
|
||||
abstract_category="false" />
|
||||
|
||||
<ccm_core.categories object_id="-2200"
|
||||
unique_id="b163f73c-9ac2-44d7-a037-de621f5ca828"
|
||||
name="info_assets"
|
||||
enabled="true"
|
||||
visible="true"
|
||||
abstract_category="false"/>
|
||||
|
||||
<ccm_core.category_titles object_id="-2100"
|
||||
locale="en"
|
||||
localized_value="info_root" />
|
||||
|
||||
<ccm_core.category_titles object_id="-2200"
|
||||
locale="en"
|
||||
localized_value="info_assets" />
|
||||
|
||||
<ccm_core.resources object_id="-1100"
|
||||
created="2016-07-15" />
|
||||
|
||||
<ccm_core.resource_titles object_id="-1100"
|
||||
locale="en"
|
||||
localized_value="info" />
|
||||
|
||||
<ccm_core.resource_descriptions object_id="-1100"
|
||||
locale="en"
|
||||
localized_value="Initial content section" />
|
||||
|
||||
<ccm_core.applications object_id="-1100"
|
||||
application_type="org.librecms.contentsection.ContentSection"
|
||||
primary_url="info" />
|
||||
|
||||
<ccm_cms.content_sections object_id="-1100"
|
||||
label="info"
|
||||
root_documents_folder_id="-2100"
|
||||
root_assets_folder_id="-2200" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3100"
|
||||
name="info_alert_recipient" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3200"
|
||||
name="info_author" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3300"
|
||||
name="info_editor" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3400"
|
||||
name="info_manager" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3500"
|
||||
name="info_publisher" />
|
||||
|
||||
<ccm_core.ccm_roles role_id="-3600"
|
||||
name="info_content_reader" />
|
||||
|
||||
<ccm_core.permissions permission_id="-4110"
|
||||
granted_privilege="categorize_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4120"
|
||||
granted_privilege="create_new_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4130"
|
||||
granted_privilege="edit_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4140"
|
||||
granted_privilege="view_published_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4150"
|
||||
granted_privilege="preview_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3200"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4210"
|
||||
granted_privilege="categorize_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4220"
|
||||
granted_privilege="create_new_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4230"
|
||||
granted_privilege="edit_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4240"
|
||||
granted_privilege="approve_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4250"
|
||||
granted_privilege="delete_item"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4260"
|
||||
granted_privilege="view_published_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4270"
|
||||
granted_privilege="preview_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3300"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4310"
|
||||
granted_privilege="administer_roles"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4320"
|
||||
granted_privilege="administer_workflow"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4330"
|
||||
granted_privilege="administer_lifecyles"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4340"
|
||||
granted_privilege="administer_categories"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4350"
|
||||
granted_privilege="administer_content_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4360"
|
||||
granted_privilege="categorize_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4370"
|
||||
granted_privilege="create_new_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4380"
|
||||
granted_privilege="edit_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4390"
|
||||
granted_privilege="approve_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4400"
|
||||
granted_privilege="publish_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4410"
|
||||
granted_privilege="delete_item"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4420"
|
||||
granted_privilege="view_published_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4430"
|
||||
granted_privilege="preview_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3400"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4510"
|
||||
granted_privilege="categorize_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4520"
|
||||
granted_privilege="create_new_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4530"
|
||||
granted_privilege="edit_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4540"
|
||||
granted_privilege="approve_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4550"
|
||||
granted_privilege="publish_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4560"
|
||||
granted_privilege="delete_item"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4570"
|
||||
granted_privilege="view_published_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4580"
|
||||
granted_privilege="preview_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3500"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
<ccm_core.permissions permission_id="-4610"
|
||||
granted_privilege="view_published_items"
|
||||
object_id="-2100"
|
||||
grantee_id="-3600"
|
||||
creation_date="2016-07-15"/>
|
||||
|
||||
</dataset>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
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;
|
||||
|
||||
DELETE FROM ccm_core.settings;
|
||||
|
||||
DELETE FROM ccm_core.categorizations;
|
||||
|
||||
DELETE FROM ccm_core.category_domains;
|
||||
|
||||
DELETE FROM ccm_core.categories;
|
||||
|
||||
DELETE FROM ccm_core.permissions;
|
||||
|
||||
DELETE FROM ccm_core.ccm_objects;
|
||||
|
||||
DELETE FROM ccm_core.role_memberships;
|
||||
|
||||
DELETE FROM ccm_core.group_memberships;
|
||||
|
||||
DELETE FROM ccm_core.groups;
|
||||
|
||||
DELETE FROM ccm_core.one_time_auth_tokens;
|
||||
|
||||
DELETE FROM ccm_core.users;
|
||||
|
||||
DELETE FROM ccm_core.user_email_addresses;
|
||||
|
||||
DELETE FROM ccm_core.parties;
|
||||
|
||||
DELETE FROM ccm_core.ccm_roles;
|
||||
|
||||
ALTER SEQUENCE hibernate_sequence RESTART WITH 1;
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
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;
|
||||
|
||||
DELETE FROM ccm_core.settings;
|
||||
|
||||
DELETE FROM ccm_core.categorizations;
|
||||
|
||||
DELETE FROM ccm_core.category_domains;
|
||||
|
||||
DELETE FROM ccm_core.categories;
|
||||
|
||||
DELETE FROM ccm_core.permissions;
|
||||
|
||||
DELETE FROM ccm_core.ccm_objects;
|
||||
|
||||
DELETE FROM ccm_core.role_memberships;
|
||||
|
||||
DELETE FROM ccm_core.group_memberships;
|
||||
|
||||
DELETE FROM ccm_core.groups;
|
||||
|
||||
DELETE FROM ccm_core.one_time_auth_tokens;
|
||||
|
||||
DELETE FROM ccm_core.users;
|
||||
|
||||
DELETE FROM ccm_core.user_email_addresses;
|
||||
|
||||
DELETE FROM ccm_core.parties;
|
||||
|
||||
DELETE FROM ccm_core.ccm_roles;
|
||||
|
||||
ALTER SEQUENCE hibernate_sequence RESTART;
|
||||
ccm-core/src/test/resources/scripts/pgsql-cleanup.sql
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
|
||||
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
||||
version="2.5">
|
||||
|
||||
<display-name>CcmCoreTest</display-name>
|
||||
|
||||
<filter>
|
||||
<filter-name>ShiroFilter</filter-name>
|
||||
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>ShiroFilter</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
|
||||
<listener>
|
||||
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
|
||||
</listener>
|
||||
</web-app>
|
||||
|
||||
|
|
@ -68,10 +68,10 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.3</version>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<optimize>true</optimize>
|
||||
<debug>true</debug>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
|
|
@ -85,7 +85,7 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.3</version>
|
||||
<version>2.10.4</version>
|
||||
<configuration>
|
||||
<detectLinks>true</detectLinks>
|
||||
<detectJavaApiLinks>true</detectJavaApiLinks>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
|
|||
import org.jboss.arquillian.persistence.dbunit.dataset.yaml.YamlDataSet;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -116,35 +118,39 @@ public class DatasetsVerifier {
|
|||
}
|
||||
}
|
||||
final String connectionStr = buffer.toString();
|
||||
try (Connection connection = DriverManager.getConnection(
|
||||
try (final Connection connection = DriverManager.getConnection(
|
||||
connectionStr, "sa", "")) {
|
||||
//Create DB tables etc
|
||||
final Path schemaPath = Paths.get(getClass().getResource(
|
||||
"/sql/ddl/auto/h2.sql").toURI());
|
||||
RunScript.execute(connection, Files.newBufferedReader(
|
||||
schemaPath, StandardCharsets.UTF_8));
|
||||
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();
|
||||
|
||||
//Get dataset to test
|
||||
final IDataSet dataSet;
|
||||
switch(getDatasetType()) {
|
||||
switch (getDatasetType()) {
|
||||
case FLAT_XML:
|
||||
final FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
|
||||
final FlatXmlDataSetBuilder builder
|
||||
= new FlatXmlDataSetBuilder();
|
||||
dataSet = builder.build(getClass().getResourceAsStream(
|
||||
datasetPath));
|
||||
break;
|
||||
case JSON:
|
||||
dataSet = new JsonDataSet(getClass()
|
||||
.getResourceAsStream(datasetPath));
|
||||
.getResourceAsStream(datasetPath));
|
||||
break;
|
||||
case YAML:
|
||||
dataSet = new YamlDataSet(getClass()
|
||||
.getResourceAsStream(datasetPath));
|
||||
.getResourceAsStream(datasetPath));
|
||||
break;
|
||||
default:
|
||||
throw new IllegalArgumentException(String.format(
|
||||
"Unsupported DatasetType \"%s\"",
|
||||
getDatasetType()));
|
||||
"Unsupported DatasetType \"%s\"",
|
||||
getDatasetType()));
|
||||
}
|
||||
|
||||
//Create DBUnit DB connection
|
||||
|
|
@ -165,6 +171,20 @@ public class DatasetsVerifier {
|
|||
}
|
||||
}
|
||||
|
||||
protected String[] getDdlFiles() {
|
||||
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());
|
||||
RunScript.execute(connection, Files.newBufferedReader(
|
||||
schemaPath, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
private void verifyDumping(final IDatabaseConnection connection)
|
||||
throws SQLException, IOException, DataSetException {
|
||||
final IDataSet data = connection.createDataSet();
|
||||
|
|
|
|||
Loading…
Reference in New Issue