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

View File

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

View File

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