CCM NG: FilePortationTest now deploys without errors

git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3977 8810af33-2d31-482b-a856-94f89814c4df
pull/2/head
jensp 2016-04-07 08:47:09 +00:00
parent 84e44321e6
commit 4e55d0279e
4 changed files with 109 additions and 101 deletions

View File

@ -18,6 +18,7 @@
*/
package org.libreccm.jpa;
import javax.enterprise.context.ApplicationScoped;
import org.hibernate.envers.AuditReader;
import org.hibernate.envers.AuditReaderFactory;
@ -29,6 +30,8 @@ import javax.persistence.EntityManager;
*
* @author <a href="mailto:jens.pelzetter@googlemail.com">Jens Pelzetter</a>
*/
@ApplicationScoped
@SuppressWarnings("PMD.UnusedPrivateField")
public class AuditReaderProducer {
@Inject

View File

@ -38,16 +38,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.libreccm.categorization.Categorization;
import org.libreccm.core.CcmObject;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.security.Permission;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.web.CcmApplication;
import org.libreccm.workflow.Workflow;
import java.io.File;
import java.math.BigDecimal;
@ -108,19 +99,26 @@ public class ConfigurationManagerTest {
return ShrinkWrap
.create(WebArchive.class,
"LibreCCM-org.libreccm.categorization.ConfigurationManagerTest.war")
.addPackage(CcmObject.class.getPackage())
.addPackage(Permission.class.getPackage())
.addPackage(CcmApplication.class.getPackage())
.addPackage(Categorization.class.getPackage())
.addPackage(Configuration.class.getPackage())
.addPackage(LocalizedString.class.getPackage())
.addPackage(Workflow.class.getPackage())
.addPackage(EntityManagerProducer.class.getPackage())
.addPackage(MimeTypeConverter.class.getPackage())
.addPackage(EqualsVerifier.class.getPackage())
.addPackage(IntegrationTest.class.getPackage())
.addPackage(TestConfiguration.class.getPackage())
"LibreCCM-org.libreccm.categorization."
+ "ConfigurationManagerTest.war")
.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())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class.
getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addAsLibraries(libs)
.addAsResource("test-persistence.xml",
"META-INF/persistence.xml")

View File

@ -18,16 +18,17 @@
*/
package org.libreccm.docrepo;
import javax.enterprise.context.RequestScoped;
import org.libreccm.portation.Marshals;
import javax.faces.bean.RequestScoped;
import javax.inject.Inject;
/**
* Marshaller class for importing and exporting {@code File}s from the
* system into a specified file and the other way around.
*
* @author <a href="mailto:tosmers@uni-bremen.de>Tobias Osmers</a>
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
* @version created the 3/16/16
*/
@RequestScoped

View File

@ -30,7 +30,6 @@ 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.jboss.shrinkwrap.resolver.api.maven.ScopeType;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@ -40,19 +39,15 @@ import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.libreccm.docrepo.File;
import org.libreccm.docrepo.FileMarshaller;
import org.libreccm.jpa.EntityManagerProducer;
import org.libreccm.jpa.utils.MimeTypeConverter;
import org.libreccm.l10n.LocalizedString;
import org.libreccm.portation.Format;
import org.libreccm.tests.categories.IntegrationTest;
import org.libreccm.testutils.EqualsVerifier;
import org.libreccm.workflow.Workflow;
import javax.inject.Inject;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.libreccm.portation.Marshals;
import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
@ -70,9 +65,11 @@ import static org.junit.Assert.assertThat;
@CreateSchema({"create_ccm_docrepo_schema.sql"})
public class FilePortationTest {
private static final Logger log = Logger.getLogger(FilePortationTest.class);
private static final Logger LOGGER = Logger.getLogger(
FilePortationTest.class);
@Inject
@Marshals(File.class)
private FileMarshaller fileMarshaller;
private static File file;
@ -124,8 +121,9 @@ public class FilePortationTest {
.loadPomFromFile("../ccm-core/pom.xml");
final PomEquippedResolveStage coreDependencies = corePom
.importCompileAndRuntimeDependencies();
final java.io.File[] coreLibs = coreDependencies.resolve().withoutTransitivity().asFile();
for(java.io.File lib : coreLibs) {
final java.io.File[] coreLibs = coreDependencies.resolve().
withTransitivity().asFile();
for (java.io.File lib : coreLibs) {
System.err.printf("Adding file '%s' to test archive...%n",
lib.getName());
}
@ -134,24 +132,30 @@ public class FilePortationTest {
.create(WebArchive.class,
"LibreCCM-org.libreccm.docrepo.FilePortationTest.war")
.addPackage(
org.libreccm.auditing.AbstractAuditedEntityRepository.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
org.libreccm.auditing.AbstractAuditedEntityRepository.class.
getPackage())
.addPackage(org.libreccm.categorization.Categorization.class
.getPackage())
.addPackage(org.libreccm.docrepo.FileMarshaller.class.getPackage())
.addPackage(
org.libreccm.configuration.ConfigurationManager.class
.getPackage())
.addPackage(org.libreccm.core.CcmObject.class.getPackage())
.addPackage(org.libreccm.docrepo.FileMarshaller.class.
getPackage())
.addPackage(org.libreccm.jpa.EntityManagerProducer.class
.getPackage())
.addPackage(org.libreccm.jpa.utils.MimeTypeConverter.class
.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class.getPackage())
.addPackage(org.libreccm.l10n.LocalizedString.class
.getPackage())
.addPackage(org.libreccm.portal.Portlet.class.getPackage())
.addPackage(org.libreccm.portation.AbstractMarshaller.class
.getPackage())
.addPackage(org.libreccm.security.Permission.class.getPackage())
.addPackage(org.libreccm.web.CcmApplication.class.getPackage())
.addPackage(org.libreccm.workflow.Workflow.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.getPackage())
.addPackage(org.libreccm.testutils.EqualsVerifier.class.
getPackage())
.addPackage(org.libreccm.tests.categories.IntegrationTest.class
.getPackage())
.addAsLibraries(libs)
@ -163,6 +167,13 @@ public class FilePortationTest {
}
@Test
@InSequence(10)
public void fileMarshallerIsInjected() {
assertThat(fileMarshaller, is(not(nullValue())));
}
@Test
@InSequence(100)
public void xmlShouldBeCreated() {
fileMarshaller.prepare(Format.XML, filePath + "test1.xml");
List<File> fileList = Collections.singletonList(file);
@ -171,14 +182,9 @@ public class FilePortationTest {
}
@Test
@InSequence(200)
public void docrepoFileShouldBeCreated() {
// TODO: test file import
}
@Test
@InSequence(10)
public void repoIsInjected() {
assertThat(fileMarshaller, is(not(nullValue())));
}
}