diff --git a/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java b/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java
index 1d654eb14..be907b1ec 100644
--- a/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java
+++ b/ccm-core/src/main/java/org/libreccm/portation/AbstractMarshaller.java
@@ -83,6 +83,25 @@ public abstract class AbstractMarshaller
{
}
}
+ /**
+ * Same as {@code prepare}-methode above. Adds distinction between path
+ * and filename.
+ *
+ * @param format The format of the ex-/import
+ * @param folderPath The folderPath of the file exported to or imported
+ * from
+ * @param filename The filename of the file exported to or imported from
+ * @param indentation whether or not indentation
+ */
+ public void prepare(final Format format,
+ String folderPath, String filename,
+ boolean indentation) {
+ File file = new File(folderPath);
+ if (file.exists() || file.mkdirs()) {
+ prepare(format, folderPath + "/" + filename, indentation);
+ }
+ }
+
/**
* Export routine for lists with the same object type {@code P}. Creates a
diff --git a/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java b/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java
index dc379ce17..6fd279b33 100644
--- a/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java
+++ b/ccm-core/src/main/java/org/libreccm/portation/Marshaller.java
@@ -47,8 +47,8 @@ public class Marshaller {
@Any
private Instance> marshallerInstances;
- // Assigns lists with objects of the same type as values to their typ.
- // The type represents the key
+ // Maps lists with objects of the same type to their typ.
+ // The type represents the key, the lists the values
private Map, List> classListMap;
/**
@@ -153,7 +153,7 @@ public class Marshaller {
* @param format The import style
* @param The type of the current marshaller
*/
- public
void importObjects(
+ public
void importFiles(
List filenames, Format format) {
for (String filename : filenames) {
String[] splitFilename = filename.split("__");
diff --git a/ccm-core/src/test/java/org/libreccm/portation/CoreDataImportTest.java b/ccm-core/src/test/java/org/libreccm/portation/CoreDataImportTest.java
new file mode 100644
index 000000000..4a7e41f8b
--- /dev/null
+++ b/ccm-core/src/test/java/org/libreccm/portation/CoreDataImportTest.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (C) 2015 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.portation;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.junit.Arquillian;
+import org.jboss.arquillian.junit.InSequence;
+import org.jboss.arquillian.persistence.CreateSchema;
+import org.jboss.arquillian.persistence.PersistenceTest;
+import org.jboss.arquillian.transaction.api.annotation.TransactionMode;
+import org.jboss.arquillian.transaction.api.annotation.Transactional;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+import org.jboss.shrinkwrap.api.asset.EmptyAsset;
+import org.jboss.shrinkwrap.api.spec.WebArchive;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.libreccm.tests.categories.IntegrationTest;
+
+import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
+
+
+/**
+ * Test class. Tests the import capabilities of the core module
+ * {@code Portation} with data from the trunk implementations
+ *
+ * @author categories = categoryMarshaller.importFile();
+ }
+
+ static void importCategorizations() {
+ CategorizationMarshaller categorizationMarshaller = new
+ CategorizationMarshaller();
+ categorizationMarshaller.prepare(Format.XML, pathName,
+ "categorizations", indentation);
+ categorizationMarshaller.importFile();
+ }
+
+ static void importUsers() {
+ UserMarshaller userMarshaller = new UserMarshaller();
+ userMarshaller.prepare(Format.XML, pathName,
+ "users", indentation);
+ userMarshaller.importFile();
+ }
+
+ static void importGroups() {
+ GroupMarshaller groupMarshaller = new GroupMarshaller();
+ groupMarshaller.prepare(Format.XML, pathName,
+ "groups", indentation);
+ groupMarshaller.importFile();
+ }
+
+ static void importGroupMemberships() {
+ GroupMembershipMarshaller groupMembershipMarshaller = new
+ GroupMembershipMarshaller();
+ groupMembershipMarshaller.prepare(Format.XML, pathName,
+ "groupMemberships", indentation);
+ groupMembershipMarshaller.importFile();
+ }
+
+ static void importRoles() {
+ RoleMarshaller roleMarshaller = new RoleMarshaller();
+ roleMarshaller.prepare(Format.XML, pathName,
+ "roles", indentation);
+ roleMarshaller.importFile();
+ }
+
+ static void importRoleMemberships() {
+ RoleMembershipMarshaller roleMembershipMarshaller = new
+ RoleMembershipMarshaller();
+ roleMembershipMarshaller.prepare(Format.XML, pathName,
+ "roleMemberships", indentation);
+ roleMembershipMarshaller.importFile();
+ }
+
+ static void importWorkflowTemplates() {
+ WorkflowTemplateMarshaller workflowTemplateMarshaller = new
+ WorkflowTemplateMarshaller();
+ workflowTemplateMarshaller.prepare(Format.XML, pathName,
+ "workflowTemplates", indentation);
+ workflowTemplateMarshaller.importFile();
+ }
+
+ static void importWorkflows() {
+ WorkflowMarshaller workflowMarshaller = new
+ WorkflowMarshaller();
+ workflowMarshaller.prepare(Format.XML, pathName,
+ "workflows", indentation);
+ workflowMarshaller.importFile();
+ }
+
+ static void importAssignableTasks() {
+ AssignableTaskMarshaller assignableTaskMarshaller = new
+ AssignableTaskMarshaller();
+ assignableTaskMarshaller.prepare(Format.XML, pathName,
+ "assignableTasks", indentation);
+ assignableTaskMarshaller.importFile();
+ }
+
+ static void importTaskAssignments() {
+ TaskAssignmentMarshaller taskAssignmentMarshaller = new
+ TaskAssignmentMarshaller();
+ taskAssignmentMarshaller.prepare(Format.XML, pathName,
+ "taskAssignments", indentation);
+ taskAssignmentMarshaller.importFile();
+ }
+
+ static void importPermissions() {
+ PermissionMarshaller permissionMarshaller = new
+ PermissionMarshaller();
+ permissionMarshaller.prepare(Format.XML, pathName,
+ "permissions", indentation);
+ permissionMarshaller.importFile();
+ }
+
+}
diff --git a/ccm-docrepo/src/test/java/org/libreccm/docrepo/portation/FilePortationTest.java b/ccm-docrepo/src/test/java/org/libreccm/docrepo/portation/FilePortationTest.java
index ab6834527..d50b97ec1 100644
--- a/ccm-docrepo/src/test/java/org/libreccm/docrepo/portation/FilePortationTest.java
+++ b/ccm-docrepo/src/test/java/org/libreccm/docrepo/portation/FilePortationTest.java
@@ -29,8 +29,6 @@ import org.jboss.arquillian.transaction.api.annotation.Transactional;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
-import org.jboss.shrinkwrap.resolver.api.maven.Maven;
-import org.jboss.shrinkwrap.resolver.api.maven.PomEquippedResolveStage;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -55,11 +53,10 @@ import java.util.List;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.libreccm.testutils.DependenciesHelpers.*;
+import static org.libreccm.testutils.DependenciesHelpers.getCcmCoreDependencies;
+import static org.libreccm.testutils.DependenciesHelpers.getModuleDependencies;
/**
- *
- *
*
* @author Tobias Osmers
* @version 13/01/2016