changes test for the FileMarshaller and deletes opencsv maven dependency
git-svn-id: https://svn.libreccm.org/ccm/ccm_ng@3932 8810af33-2d31-482b-a856-94f89814c4dfpull/2/head
parent
59088cb39a
commit
080dc7c00f
|
|
@ -183,11 +183,6 @@
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.opencsv</groupId>
|
|
||||||
<artifactId>opencsv</artifactId>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -38,22 +38,26 @@ import org.junit.Test;
|
||||||
import org.junit.experimental.categories.Category;
|
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.FileRepository;
|
import org.libreccm.docrepo.FileMarshaller;
|
||||||
import org.libreccm.jpa.EntityManagerProducer;
|
import org.libreccm.jpa.EntityManagerProducer;
|
||||||
import org.libreccm.jpa.utils.MimeTypeConverter;
|
import org.libreccm.jpa.utils.MimeTypeConverter;
|
||||||
import org.libreccm.l10n.LocalizedString;
|
import org.libreccm.l10n.LocalizedString;
|
||||||
|
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.testutils.EqualsVerifier;
|
||||||
import org.libreccm.workflow.Workflow;
|
import org.libreccm.workflow.Workflow;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static org.hamcrest.CoreMatchers.*;
|
import static org.hamcrest.CoreMatchers.*;
|
||||||
import static org.junit.Assert.assertThat;
|
import static org.junit.Assert.assertThat;
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
* @author <a href="mailto:tosmers@uni-bremen.de">Tobias Osmers</a>
|
||||||
* @version 13/01/2016
|
* @version 13/01/2016
|
||||||
|
|
@ -67,15 +71,11 @@ public class FilePortationTest {
|
||||||
private static final Logger log = Logger.getLogger(FilePortationTest.class);
|
private static final Logger log = Logger.getLogger(FilePortationTest.class);
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private FileRepository fileRepository;
|
private FileMarshaller fileMarshaller;
|
||||||
|
|
||||||
private static File file;
|
private static File file;
|
||||||
private static String filename =
|
private static String filePath =
|
||||||
"src/test/resources/datasets/org/libreccm/docrepo" +
|
"src/test/resources/datasets/org/libreccm/docrepo/FilePortationTest/";
|
||||||
"/FilePortationTest/csv/exportTest.csv";
|
|
||||||
|
|
||||||
public FilePortationTest() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpClass() {
|
public static void setUpClass() {
|
||||||
|
|
@ -137,21 +137,13 @@ public class FilePortationTest {
|
||||||
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
.addAsWebInfResource(EmptyAsset.INSTANCE, "WEB-INF/beans.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO add test methods here.
|
|
||||||
// The methods must be annotated with annotation @Test. For example:
|
|
||||||
//
|
|
||||||
// @Test
|
|
||||||
// public void hello() {}
|
|
||||||
@Test
|
@Test
|
||||||
public void csvShouldBeCreated() {
|
public void xmlShouldBeCreated() {
|
||||||
java.io.File old = new java.io.File(filename);
|
fileMarshaller.prepare(Format.XML, filePath + "test1.xml");
|
||||||
if (old.exists())
|
List<File> fileList = Collections.singletonList(file);
|
||||||
old.delete();
|
|
||||||
|
|
||||||
// TODO: test file export
|
fileMarshaller.exportList(fileList);
|
||||||
|
|
||||||
java.io.File file = new java.io.File(filename);
|
|
||||||
assertTrue(file.exists() && !file.isDirectory());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -162,6 +154,6 @@ public class FilePortationTest {
|
||||||
@Test
|
@Test
|
||||||
@InSequence(10)
|
@InSequence(10)
|
||||||
public void repoIsInjected() {
|
public void repoIsInjected() {
|
||||||
assertThat(fileRepository, is(not(nullValue())));
|
assertThat(fileMarshaller, is(not(nullValue())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue