diff --git a/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java b/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java
index 837fe127a..fdd486525 100644
--- a/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java
+++ b/ccm-core/src/main/java/com/arsdigita/ui/UIConfig.java
@@ -29,6 +29,8 @@ import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;
+import javax.enterprise.inject.spi.CDI;
+
/**
*
* @author Jens Pelzetter
@@ -50,12 +52,14 @@ public final class UIConfig {
private String userRedirectUrl = "/permissions/";
@Setting
- private String workspaceUrl = "pvt/";
+ private String workspaceUrl = "/pvt/";
public static UIConfig getConfig() {
- final CdiUtil cdiUtil = new CdiUtil();
- final ConfigurationManager confManager = cdiUtil.findBean(
- ConfigurationManager.class);
+// final CdiUtil cdiUtil = new CdiUtil();
+// final ConfigurationManager confManager = cdiUtil.findBean(
+// ConfigurationManager.class);
+ final ConfigurationManager confManager = CDI.current().select(
+ ConfigurationManager.class).get();
return confManager.findConfiguration(UIConfig.class);
}
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/AdminApplicationSetup.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/AdminApplicationSetup.java
index 82a1707ab..ebe9e61d2 100644
--- a/ccm-core/src/main/java/com/arsdigita/ui/admin/AdminApplicationSetup.java
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/AdminApplicationSetup.java
@@ -18,6 +18,7 @@
*/
package com.arsdigita.ui.admin;
+import org.libreccm.modules.InstallEvent;
import org.libreccm.web.CcmApplication;
import org.libreccm.web.AbstractCcmApplicationSetup;
@@ -31,8 +32,8 @@ public class AdminApplicationSetup extends AbstractCcmApplicationSetup {
public static final String ADMIN_APP_NAME = "CcmAdmin";
- public AdminApplicationSetup(final EntityManager entityManager) {
- super(entityManager);
+ public AdminApplicationSetup(final InstallEvent event) {
+ super(event);
}
@Override
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/admin/GroupAdministrationTab.java b/ccm-core/src/main/java/com/arsdigita/ui/admin/GroupAdministrationTab.java
index 7826bd4c0..c046c516d 100644
--- a/ccm-core/src/main/java/com/arsdigita/ui/admin/GroupAdministrationTab.java
+++ b/ccm-core/src/main/java/com/arsdigita/ui/admin/GroupAdministrationTab.java
@@ -547,10 +547,8 @@ class GroupAdministrationTab extends LayoutPanel implements AdminConstants,
//
// });
// body.add(deleteLink);
-// return main.addSegment(GROUP_EXTREME_ACTIONS_HEADER,
-// body);
-
- throw new UnsupportedOperationException();
+ return main.addSegment(GROUP_EXTREME_ACTIONS_HEADER,
+ body);
}
/**
diff --git a/ccm-core/src/main/java/com/arsdigita/ui/login/LoginApplicationSetup.java b/ccm-core/src/main/java/com/arsdigita/ui/login/LoginApplicationSetup.java
index 0816b0cf0..da90b87cc 100644
--- a/ccm-core/src/main/java/com/arsdigita/ui/login/LoginApplicationSetup.java
+++ b/ccm-core/src/main/java/com/arsdigita/ui/login/LoginApplicationSetup.java
@@ -18,10 +18,10 @@
*/
package com.arsdigita.ui.login;
+import org.libreccm.modules.InstallEvent;
import org.libreccm.web.AbstractCcmApplicationSetup;
import org.libreccm.web.CcmApplication;
-import javax.persistence.EntityManager;
/**
*
@@ -31,8 +31,8 @@ public class LoginApplicationSetup extends AbstractCcmApplicationSetup {
public static final String LOGIN_APP_NAME = "Login";
- public LoginApplicationSetup(final EntityManager entityManager) {
- super(entityManager);
+ public LoginApplicationSetup(final InstallEvent event) {
+ super(event);
}
@Override
diff --git a/ccm-core/src/main/java/com/arsdigita/web/CCMDispatcherServlet.java b/ccm-core/src/main/java/com/arsdigita/web/CCMDispatcherServlet.java
index 53f5272db..7bc23ad1a 100644
--- a/ccm-core/src/main/java/com/arsdigita/web/CCMDispatcherServlet.java
+++ b/ccm-core/src/main/java/com/arsdigita/web/CCMDispatcherServlet.java
@@ -41,6 +41,16 @@ import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.subject.Subject;
import org.libreccm.web.ApplicationManager;
+import org.libreccm.web.ApplicationType;
+
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.CDI;
+import javax.servlet.http.HttpServlet;
/**
*
@@ -138,10 +148,10 @@ public class CCMDispatcherServlet extends BaseServlet {
if (subject.isAuthenticated()) {
// User is logged in, redirect to user redirect page
- throw new RedirectSignal(URL.there(request,
- UI
- .getUserRedirectURL(request)),
- false);
+ throw new RedirectSignal(
+ URL.there(request,
+ UI.getUserRedirectURL(request)),
+ false);
} else {
// User is *not* logged in, display public front page
throw new RedirectSignal(URL.there(request,
@@ -206,7 +216,9 @@ public class CCMDispatcherServlet extends BaseServlet {
BaseApplicationServlet.APPLICATION_ID_ATTRIBUTE,
spec.getAppID());
request.setAttribute(DISPATCHED_ATTRIBUTE, Boolean.TRUE);
- forward(spec.getTypeContextPath(), spec.target(path), request,
+ forward(spec.getTypeContextPath(),
+ spec.target(path),
+ request,
response);
// return true;
}
@@ -266,7 +278,7 @@ public class CCMDispatcherServlet extends BaseServlet {
LOGGER.debug("forwarding from context \"{}\" to context \"{}\"...",
getServletContext(), context);
- forward(context.getRequestDispatcher(target),
+ forward(getServletContext().getRequestDispatcher(target),
request,
response);
}
@@ -304,8 +316,6 @@ public class CCMDispatcherServlet extends BaseServlet {
path);
}
-// final CcmApplication application = appRepository
-// .retrieveApplicationForPath(path);
final CcmApplication application = appManager
.findApplicationByPath(path);
@@ -313,7 +323,7 @@ public class CCMDispatcherServlet extends BaseServlet {
LOGGER.warn("No application found for path \"{}\".", path);
return null;
} else {
- return new ApplicationSpec(application);
+ return new ApplicationSpec(application, appManager);
}
}
@@ -338,12 +348,16 @@ public class CCMDispatcherServlet extends BaseServlet {
private final String m_instanceURI;
private final String m_typeURI;
private final String m_typeContextPath;
+ private final ApplicationManager appManager;
/**
*
* @param app
*/
- ApplicationSpec(CcmApplication app) {
+ ApplicationSpec(final CcmApplication app,
+ final ApplicationManager appManager) {
+ this.appManager = appManager;
+
if (app == null) {
throw new NullPointerException("app");
}
@@ -356,9 +370,56 @@ public class CCMDispatcherServlet extends BaseServlet {
.getAnnotation(ServletPath.class)
.value();
} else {
- m_typeURI = URL.SERVLET_DIR + "/legacy-adapter";
+// final ApplicationManager appManager = CDI.current().select(
+// ApplicationManager.class).get();
+// final BeanManager beanManager = CDI.current().getBeanManager();
+// final Set> beans = beanManager.getBeans(
+// ApplicationManager.class);
+// final Iterator> iterator = beans.iterator();
+// final ApplicationManager appManager;
+// if (iterator.hasNext()) {
+// @SuppressWarnings("unchecked")
+// final Bean bean
+// = (Bean) iterator
+// .next();
+// final CreationalContext ctx
+// = beanManager
+// .createCreationalContext(bean);
+//
+// appManager = (ApplicationManager) beanManager.getReference(
+// bean, ApplicationManager.class, ctx);
+// } else {
+// LOGGER.error("Failed to find {}.",
+// ApplicationManager.class.getName());
+// throw new IllegalArgumentException(String.format(
+// "Failed to find %s",
+// ApplicationManager.class.getName()));
+// }
+
+ final ApplicationType appType = appManager.getApplicationTypes()
+ .get(app.getApplicationType());
+ final Class extends HttpServlet> appServletClass = appType
+ .servlet();
+ final WebServlet servletAnnotation = appServletClass
+ .getAnnotation(WebServlet.class);
+ if (servletAnnotation != null
+ && servletAnnotation.urlPatterns() != null
+ && servletAnnotation.urlPatterns().length > 0) {
+ if (servletAnnotation.urlPatterns()[0].endsWith("*")) {
+ m_typeURI = servletAnnotation
+ .urlPatterns()[0]
+ .substring(0,
+ servletAnnotation
+ .urlPatterns()[0]
+ .length() - 1);
+ } else {
+ m_typeURI = servletAnnotation.urlPatterns()[0];
+ }
+ } else {
+ m_typeURI = "";
+ }
}
-
+
m_typeContextPath = "";
if (Assert.isEnabled()) {
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java b/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
index 52488afb3..42a32ebd4 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/CategoryRepository.java
@@ -84,14 +84,11 @@ public class CategoryRepository extends AbstractEntityRepository
+ "Valid path format: domainKey:path");
}
- final Domain domain;
- try {
- domain = domainRepo.findByDomainKey(tokens[0]);
- } catch (NoResultException ex) {
+ final Domain domain = domainRepo.findByDomainKey(tokens[0]);
+ if (domain == null) {
throw new InvalidCategoryPathException(String.format(
"No domain identified by the key '%s' found.",
- tokens[0]),
- ex);
+ tokens[0]));
}
return findByPath(domain, tokens[1]);
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
index d05f9c714..0db23b929 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/Domain.java
@@ -24,13 +24,11 @@ import static org.libreccm.core.CoreConstants.*;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.URL;
import org.libreccm.core.CcmObject;
-import org.libreccm.jpa.utils.UriConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.web.CcmApplication;
import org.omg.CORBA.DomainManager;
import java.io.Serializable;
-import java.net.URI;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -39,14 +37,17 @@ import java.util.Objects;
import javax.persistence.AssociationOverride;
import javax.persistence.Column;
-import javax.persistence.Convert;
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;
+import javax.persistence.NamedEntityGraphs;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.NamedSubgraph;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
@@ -62,7 +63,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* as well as the {@code CategoryPurpose} entity from the old
* {@code ccm-core module}.
*
- * A {@code Domain} can be mapped to multiple {@link CcmApplication}s. Normally
+ * A {@code Domain} can be mapped to multiple {@link CcmApplication}s. Normally
* This is used to make a {@code Domain} available in the application. The
* {@link CcmApplication}s to which a {@code Domain} is mapped are called
* owners of the domain.
@@ -72,11 +73,24 @@ import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name = "CATEGORY_DOMAINS", schema = DB_SCHEMA)
@NamedQueries({
- @NamedQuery(name="Domain.findByKey",
+ @NamedQuery(name = "Domain.findByKey",
query = "SELECT d FROM Domain d WHERE d.domainKey = :key"),
- @NamedQuery(name="Domain.findByUri",
+ @NamedQuery(name = "Domain.findByUri",
query = "SELECT d FROM Domain d WHERE d.uri = :uri")
})
+@NamedEntityGraphs({
+ @NamedEntityGraph(
+ name = "Domain.allCategories",
+ attributeNodes = {
+ @NamedAttributeNode(value = "root",
+ subgraph = "subCategories")},
+ subgraphs = {
+ @NamedSubgraph(
+ name = "subCategories",
+ attributeNodes = {
+ @NamedAttributeNode("subCategories")
+ })})
+})
@XmlRootElement(name = "domain", namespace = CAT_XML_NS)
public class Domain extends CcmObject implements Serializable {
@@ -106,10 +120,9 @@ public class Domain extends CcmObject implements Serializable {
*
*/
@Column(name = "URI", nullable = true, unique = true, length = 1024)
- @Convert(converter = UriConverter.class)
@URL
@XmlElement(name = "uri", namespace = CAT_XML_NS)
- private URI uri;
+ private String uri;
/**
* A human readable title for the {@code Domain}. The title can be
@@ -184,11 +197,11 @@ public class Domain extends CcmObject implements Serializable {
this.domainKey = domainKey;
}
- public URI getUri() {
+ public String getUri() {
return uri;
}
- public void setUri(final URI uri) {
+ public void setUri(final String uri) {
this.uri = uri;
}
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
index 3172a94ed..d711db066 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainManager.java
@@ -36,22 +36,53 @@ public class DomainManager {
@Inject
private ApplicationRepository applicationRepo;
-
+
@Inject
private DomainRepository domainRepo;
+ @Inject
+ private CategoryRepository categoryRepo;
+
@Inject
private EntityManager entityManager;
+ /**
+ * Creates a new domain with the provided key (name) and a root category
+ * with the provided name. The domain and the root category can be further
+ * customised after the creation.
+ *
+ * @param domainKey The key (name) of the new domain.
+ * @param rootCategoryName The name of the root category of the new domain.
+ * @return The new domain.
+ */
+ public Domain createDomain(final String domainKey,
+ final String rootCategoryName) {
+ final Domain domain = new Domain();
+ domain.setDomainKey(domainKey);
+ domain.setVersion("1.0");
+ domain.setDisplayName(domainKey);
+
+ final Category root = new Category();
+ root.setName(rootCategoryName);
+ root.setDisplayName(rootCategoryName);
+
+ domain.setRoot(root);
+
+ categoryRepo.save(root);
+ domainRepo.save(domain);
+
+ return domain;
+ }
+
/**
* Adds a {@code CcmApplication} to the owners of a {@link Domain}. If the
* provided {@code CcmApplication} is already an owner of the provided
* {@code Domain} the method does nothing.
*
* @param application The {@code CcmApplication} to add to the owners of the
- * {@code Domain}.
- * @param domain The {@code Domain} to which owners the
- * {@code CcmApplication is added}.
+ * {@code Domain}.
+ * @param domain The {@code Domain} to which owners the
+ * {@code CcmApplication is added}.
*/
public void addDomainOwner(final CcmApplication application,
final Domain domain) {
@@ -60,24 +91,24 @@ public class DomainManager {
ownership.setOwner(application);
ownership.setOwnerOrder(domain.getOwners().size() + 1);
ownership.setDomainOrder(application.getDomains().size() + 1);
-
+
application.addDomain(ownership);
domain.addOwner(ownership);
-
+
entityManager.persist(ownership);
applicationRepo.save(application);
domainRepo.save(domain);
}
/**
- * Removes a {@code CcmApplication} from the owners of a {@code Domain}. If the
- * provided {@code CcmApplication} is not an owner of the provided
+ * Removes a {@code CcmApplication} from the owners of a {@code Domain}. If
+ * the provided {@code CcmApplication} is not an owner of the provided
* {@code Domain} the method does nothing.
*
- * @param application The {@code CcmApplication} to remove from the owners of
- * the provided {@code Domain}.
- * @param domain The {@code Domain} from which owners the provided
- * {@code CcmApplication} should be removed.
+ * @param application The {@code CcmApplication} to remove from the owners
+ * of the provided {@code Domain}.
+ * @param domain The {@code Domain} from which owners the provided
+ * {@code CcmApplication} should be removed.
*/
public void removeDomainOwner(final CcmApplication application,
final Domain domain) {
@@ -87,10 +118,10 @@ public class DomainManager {
/**
* Determines if a {@link CcmApplication} is an owner of {@link Domain}.
- *
+ *
* @param application The {@code CcmApplication} to test.
* @param domain The {@code Domain} to test.
- * @return {@code true} if the provided {@code CcmApplication} is an owner
+ * @return {@code true} if the provided {@code CcmApplication} is an owner
* of the provided {@code Domain}, {@code false} otherwise.
*/
public boolean isDomainOwner(final CcmApplication application,
diff --git a/ccm-core/src/main/java/org/libreccm/categorization/DomainRepository.java b/ccm-core/src/main/java/org/libreccm/categorization/DomainRepository.java
index a5c63a314..69433eb05 100644
--- a/ccm-core/src/main/java/org/libreccm/categorization/DomainRepository.java
+++ b/ccm-core/src/main/java/org/libreccm/categorization/DomainRepository.java
@@ -24,6 +24,7 @@ import java.net.URI;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
+import javax.persistence.EntityGraph;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
@@ -61,6 +62,10 @@ public class DomainRepository extends AbstractEntityRepository {
final TypedQuery query = entityManager.createNamedQuery(
"Domain.findByKey", Domain.class);
query.setParameter("key", domainKey);
+
+ final EntityGraph> graph = entityManager.getEntityGraph(
+ "Domain.allCategories");
+ query.setHint("javax.persistence.fetchgraph", graph);
try {
return query.getSingleResult();
diff --git a/ccm-core/src/main/java/org/libreccm/configuration/ConfigurationManager.java b/ccm-core/src/main/java/org/libreccm/configuration/ConfigurationManager.java
index 65a95d206..c06a3a158 100644
--- a/ccm-core/src/main/java/org/libreccm/configuration/ConfigurationManager.java
+++ b/ccm-core/src/main/java/org/libreccm/configuration/ConfigurationManager.java
@@ -52,7 +52,7 @@ public class ConfigurationManager {
@Inject
private SettingConverter settingConverter;
-
+
@Inject
private CategoryManager categoryManager;
@@ -269,7 +269,6 @@ public class ConfigurationManager {
// "No setting type for value type \"%s\".", valueTypeName));
// }
// }
-
/**
* Sets a value on a setting in the registry.
*
@@ -348,8 +347,7 @@ public class ConfigurationManager {
return null;
}
- final Domain registry = domainRepo
- .findByDomainKey(REGISTRY_DOMAIN);
+ final Domain registry = domainRepo.findByDomainKey(REGISTRY_DOMAIN);
if (categoryRepo.findByPath(registry, confName) == null) {
return conf;
}
@@ -453,7 +451,7 @@ public class ConfigurationManager {
categoryPath);
return categories[categories.length - 1];
}
-
+
private String buildCategoryPath(final String[] tokens,
final int index) {
final StringJoiner joiner = new StringJoiner(".");
diff --git a/ccm-core/src/main/java/org/libreccm/core/CcmCore.java b/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
index 9d621fc31..50230d11f 100644
--- a/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
+++ b/ccm-core/src/main/java/org/libreccm/core/CcmCore.java
@@ -25,6 +25,7 @@ import com.arsdigita.ui.login.LoginApplicationCreator;
import com.arsdigita.ui.login.LoginServlet;
import com.arsdigita.ui.login.LoginApplicationSetup;
+import org.libreccm.categorization.RegistrySetup;
import org.libreccm.modules.CcmModule;
import org.libreccm.modules.InitEvent;
import org.libreccm.modules.InstallEvent;
@@ -33,7 +34,6 @@ import org.libreccm.modules.ShutdownEvent;
import org.libreccm.modules.UnInstallEvent;
import org.libreccm.security.SystemUsersSetup;
-import javax.persistence.EntityManager;
import org.libreccm.web.ApplicationType;
@@ -98,16 +98,19 @@ public class CcmCore implements CcmModule {
@Override
public void install(final InstallEvent event) {
- final EntityManager entityManager = event.getEntityManager();
+// final EntityManager entityManager = event.getEntityManager();
final SystemUsersSetup systemUsersSetup = new SystemUsersSetup(
- entityManager);
+ event);
systemUsersSetup.setupSystemUsers();
- final AdminApplicationSetup adminSetup = new AdminApplicationSetup(entityManager);
+ final RegistrySetup registrySetup = new RegistrySetup(event);
+ registrySetup.setup();
+
+ final AdminApplicationSetup adminSetup = new AdminApplicationSetup(event);
adminSetup.setup();
- final LoginApplicationSetup loginSetup = new LoginApplicationSetup(entityManager);
+ final LoginApplicationSetup loginSetup = new LoginApplicationSetup(event);
loginSetup.setup();
}
diff --git a/ccm-core/src/main/java/org/libreccm/security/SystemUsersSetup.java b/ccm-core/src/main/java/org/libreccm/security/SystemUsersSetup.java
index 3d188cbe7..e3e7be9b8 100644
--- a/ccm-core/src/main/java/org/libreccm/security/SystemUsersSetup.java
+++ b/ccm-core/src/main/java/org/libreccm/security/SystemUsersSetup.java
@@ -22,6 +22,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.libreccm.core.CcmCore;
import org.libreccm.core.EmailAddress;
+import org.libreccm.modules.InstallEvent;
import java.io.IOException;
import java.io.InputStream;
@@ -45,8 +46,8 @@ public class SystemUsersSetup {
private final EntityManager entityManager;
- public SystemUsersSetup(final EntityManager entityManager) {
- this.entityManager = entityManager;
+ public SystemUsersSetup(final InstallEvent event) {
+ this.entityManager = event.getEntityManager();
}
public void setupSystemUsers() {
diff --git a/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java b/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
index 3d51f7222..94b5404e6 100644
--- a/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
+++ b/ccm-core/src/main/java/org/libreccm/web/AbstractCcmApplicationSetup.java
@@ -18,6 +18,8 @@
*/
package org.libreccm.web;
+import org.libreccm.modules.InstallEvent;
+
import javax.persistence.EntityManager;
/**
@@ -28,8 +30,8 @@ public abstract class AbstractCcmApplicationSetup {
private final EntityManager entityManager;
- public AbstractCcmApplicationSetup(final EntityManager entityManager) {
- this.entityManager = entityManager;
+ public AbstractCcmApplicationSetup(final InstallEvent event) {
+ this.entityManager = event.getEntityManager();
}
protected EntityManager getEntityManager() {
diff --git a/ccm-core/src/test/java/org/libreccm/configuration/ConfigurationManagerTest.java b/ccm-core/src/test/java/org/libreccm/configuration/ConfigurationManagerTest.java
index 0a4b1bc54..657fc53a6 100644
--- a/ccm-core/src/test/java/org/libreccm/configuration/ConfigurationManagerTest.java
+++ b/ccm-core/src/test/java/org/libreccm/configuration/ConfigurationManagerTest.java
@@ -55,9 +55,6 @@ import java.math.BigDecimal;
import javax.inject.Inject;
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
-import org.libreccm.categorization.Category;
-
-import javax.persistence.TypedQuery;
import static org.hamcrest.Matchers.*;
import static org.junit.Assert.*;
diff --git a/ccm-core/src/test/java/org/libreccm/configuration/DatasetsTest.java b/ccm-core/src/test/java/org/libreccm/configuration/DatasetsTest.java
index 7b6652825..cf7bcb162 100644
--- a/ccm-core/src/test/java/org/libreccm/configuration/DatasetsTest.java
+++ b/ccm-core/src/test/java/org/libreccm/configuration/DatasetsTest.java
@@ -47,11 +47,12 @@ public class DatasetsTest extends DatasetsVerifier {
return Arrays.asList(new String[]{
"/datasets/org/libreccm/configuration/ConfigurationManagerTest/after-save-changed.yml",
"/datasets/org/libreccm/configuration/ConfigurationManagerTest/after-save-new.yml",
- "/datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml"});
+ "/datasets/org/libreccm/configuration/ConfigurationManagerTest/data.yml",
+ });
}
public DatasetsTest(final String datasetPath) {
- super(datasetPath);;
+ super(datasetPath);
}
@Override
diff --git a/ccm-docrepo/pom.xml b/ccm-docrepo/pom.xml
index 3b30dd545..6eebc76ef 100644
--- a/ccm-docrepo/pom.xml
+++ b/ccm-docrepo/pom.xml
@@ -44,12 +44,6 @@
${project.parent.version}
provided
-
- org.libreccm
- ccm-testutils
- ${project.parent.version}
- test
-
org.hibernate
diff --git a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetType.java b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetType.java
index 3720cc2d2..ae3563d77 100644
--- a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetType.java
+++ b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetType.java
@@ -23,6 +23,7 @@ package org.libreccm.testutils;
* @author Jens Pelzetter
*/
public enum DatasetType {
+ FLAT_XML,
JSON,
YAML
}
diff --git a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java
index 7717f378e..9000d22e0 100644
--- a/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java
+++ b/ccm-testutils/src/main/java/org/libreccm/testutils/DatasetsVerifier.java
@@ -42,6 +42,7 @@ import org.junit.runners.Parameterized;
import static org.libreccm.testutils.DatasetType.*;
+import org.dbunit.dataset.xml.FlatXmlDataSetBuilder;
import org.jboss.arquillian.persistence.dbunit.dataset.yaml.YamlDataSet;
import java.nio.charset.StandardCharsets;
@@ -124,6 +125,11 @@ public class DatasetsVerifier {
//Get dataset to test
final IDataSet dataSet;
switch(getDatasetType()) {
+ case FLAT_XML:
+ final FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
+ dataSet = builder.build(getClass().getResourceAsStream(
+ datasetPath));
+ break;
case JSON:
dataSet = new JsonDataSet(getClass()
.getResourceAsStream(datasetPath));