Commit 794c59f8 authored by marceteau's avatar marceteau
Browse files

ajout prise en charge correspondances_properties + retrait attribut und

parent b29d6020
......@@ -236,6 +236,11 @@
<directory>/etc/${unix.name}</directory>
<username>${unix.user}</username>
<groupname>${unix.group}</groupname>
<sources>
<source>
<location>${project.build.outputDirectory}/correspondances_properties.csv</location>
</source>
</sources>
</mapping>
<mapping>
<directory>/usr/bin</directory>
......
......@@ -114,7 +114,7 @@ public abstract class AbstractArchiveConverter implements ManifestConverter {
public enum ACCESS_RULE {
AR038("ACC-00001"), // librement communicable
AR039("ACC-00002"),
AR042("ACC-00005"),
AR042("ACC-00008"),
AR048("ACC-00020"),
AR052("ACC-00023");
......
......@@ -36,11 +36,13 @@ public interface ArchiveConverter {
* Lance la conversion d'une archive en formalisme seda1 ou sip vers une archive en format seda21
*
* @param archiveFolder
* @param agency
* @param propertiesFolder
* @return {@link File} L'archive tar au format SEDA21
* @throws DuplicateLanguageException
* @throws IngestRejectException
*/
public File convert(Path archiveFolder) throws DuplicateLanguageException, IngestRejectException;
public File convert(Path archiveFolder, String agency, Path propertiesFolder) throws DuplicateLanguageException, IngestRejectException;
/**
* répertoire de sortie
......
......@@ -69,8 +69,10 @@ public class ArchiveConverterMain {
private Path errorLanguageFolder;
private Path planClassementFile;
private Path currentArchivePath;
private Path propertiesFolder;
private String formalism;
private String agency;
/**
* @param args
......@@ -91,7 +93,8 @@ public class ArchiveConverterMain {
options.addOption("m", "only-manifest", false, "Si présente, ne fais que la conversion des manifests");
options.addOption("d", "input-folder", true, "Chemin du répertoire dans lequel se trouve les archives pour un traitement par lot. Non récursif.");
options.addOption("i", "manifest-path", true, "Chemin du manifest Archive.xml ou aip.xml ou sip.xml");
options.addOption("c", "config-agency-property-file", true, "Fichier de propriétés du Service Versant courant");
options.addOption("a", "agency", true, "Nom du service versant");
options.addOption("c", "properties", true, "Chemin vers les fichiers properties et le fichier correspondances.csv");
options.addOption("o", "output-dir", true, "Répertoire de sortie");
options.addOption("e", "error-dir", true, "Répertoire où seront placés les paquets en erreur");
options.addOption("l", "language-error-dir", true, "Répertoire où seront placés les paquets en erreur à cause de l'attribut language");
......@@ -99,6 +102,28 @@ public class ArchiveConverterMain {
CommandLine commandLine = parser.parse(options, args);
if(commandLine.hasOption("a")) {
agency = commandLine.getOptionValue("a") ;
} else {
System.err.println("Le service versant doit être indiqué.");
formatter.printHelp("archive-converter", options);
System.exit(-1);
}
if(commandLine.hasOption("c")) {
propertiesFolder = Paths.get(commandLine.getOptionValue("c")) ;
if(!propertiesFolder.toFile().exists()) {
System.err.println("Le répertoire de fichiers properties " + propertiesFolder.toString() + " n'existe pas.");
System.exit(-1);
}
} else {
System.err.println("Le répertoire de fichiers properties est obligatoire.");
formatter.printHelp("archive-converter", options);
System.exit(-1);
}
if(commandLine.hasOption("e")) {
errorFolder = Paths.get(commandLine.getOptionValue("e")) ;
if(!errorFolder.toFile().exists()) {
......@@ -196,9 +221,9 @@ public class ArchiveConverterMain {
if(formalism.equals("sip") || formalism.equals("aip")) {
if(!commandLine.hasOption("c")) {
logger.error("Le fichier de propriété du service versant est obligatoire pour un sip ou un aip");
System.err.println("Le fichier de propriété du service versant est obligatoire pour un sip ou un aip");
if(!commandLine.hasOption("a")) {
logger.error("Le service versant est obligatoirement indiqué en argument.");
System.err.println("Le service versant est obligatoirement indiqué en argument.");
System.exit(-1);
}
String planClassementPath;
......@@ -207,7 +232,7 @@ public class ArchiveConverterMain {
} else {
planClassementPath = "";
}
archiveConverter = new DCToSeda21Converter(commandLine.getOptionValue("c"), planClassementPath);
archiveConverter = new DCToSeda21Converter(commandLine.getOptionValue("a"), Paths.get(commandLine.getOptionValue("c")), planClassementPath);
archiveConverter.setOnlyManifest(true);
((AbstractArchiveConverter)archiveConverter).setSipType(formalism);
}else if(formalism.equals("seda1")) {
......@@ -219,7 +244,7 @@ public class ArchiveConverterMain {
}
try {
archiveConverter.convertManifest(originManifest, manifestXML);
archiveConverter.convertManifest(originManifest, manifestXML, agency, Paths.get(commandLine.getOptionValue("c")));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (DuplicateLanguageException e) {
......@@ -254,8 +279,8 @@ public class ArchiveConverterMain {
private void archiveConversion(CommandLine commandLine) throws IngestRejectException, IOException, NotSupportedException, DuplicateLanguageException {
ArchiveConverter archiveConverter = null;
if(formalism.equals("sip") || formalism.equals("aip")) {
if(!commandLine.hasOption("c")) {
System.err.println("Le fichier de propriété du service versant est obligatoire pour un sip");
if(!commandLine.hasOption("a")) {
System.err.println("Le service versant est obligatoirement indiqué en argument.");
System.exit(-1);
}
String planClassementPath;
......@@ -264,9 +289,9 @@ public class ArchiveConverterMain {
} else {
planClassementPath = "";
}
archiveConverter = new DCToSeda21TarMaker(commandLine.getOptionValue("c"), planClassementPath, formalism);
archiveConverter = new DCToSeda21TarMaker(commandLine.getOptionValue("a"), planClassementPath, formalism);
}else if(formalism.equals("seda1")) {
archiveConverter = new Seda1ToSeda21TarMaker();
archiveConverter = new Seda1ToSeda21TarMaker(commandLine.getOptionValue("a"));
}else {
System.err.println("Ce formalisme n'est pas reconnu, veuillez choisir sip ou seda1");
System.exit(-1);
......@@ -302,7 +327,7 @@ public class ArchiveConverterMain {
.forEach(file -> {
currentArchivePath = Paths.get(file.getAbsolutePath());
try {
ac.convert(file.toPath());
ac.convert(file.toPath(), agency, propertiesFolder);
} catch (DuplicateLanguageException e) {
manageLanguageRejectException(e);
} catch (IngestRejectException e) {
......@@ -321,7 +346,7 @@ public class ArchiveConverterMain {
if(!formalism.equals("aip")) {
depositFormControl(aipPath);
}
archiveConverter.convert(Paths.get(commandLine.getOptionValue("i")));
archiveConverter.convert(Paths.get(commandLine.getOptionValue("i")), agency, propertiesFolder);
}
}
......
......@@ -254,37 +254,28 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
private String planClassementFilePath;
private List<BinaryDataObjectTypeWithType> binaryDataObjectWithTypeList = new ArrayList<BinaryDataObjectTypeWithType>();;
public DCToSeda21Converter(String propertyFilePath, String planClassementPath) {
public DCToSeda21Converter(String agency, Path propertiesFolder, String planClassementPath) {
informationPackage = new InformationPackage();
planClassementFilePath = planClassementPath;
properties = new Properties();
try {
properties.load(new FileInputStream(propertyFilePath));
} catch (FileNotFoundException e) {
System.err.println("Impossible de trouver le fichier propriétés " + propertyFilePath);
System.exit(-1);
} catch (IOException e) {
System.err.println("Impossible de lire le fichier propriétés " + propertyFilePath);
System.exit(-1);
}
this.rootFolder = Paths.get("DEPOT");
}
public static void main(String[] args) throws FileNotFoundException, IngestRejectException {
String agencyPropertyFile = args[0];
String filePlanPath = args[1];
ManifestConverter archiveConverter = new DCToSeda21Converter(agencyPropertyFile, filePlanPath);
String agency = args[0];
Path propertiesFolder = Paths.get(args[1]);
String filePlanPath = args[2];
ManifestConverter archiveConverter = new DCToSeda21Converter(agency, propertiesFolder, filePlanPath);
String originalManifest = args[1];
String convertedManifest = args[2];
archiveConverter.convertManifest(new File(originalManifest), new File(convertedManifest));
archiveConverter.convertManifest(new File(originalManifest), new File(convertedManifest), agency, propertiesFolder);
}
@Override
public ArchiveTransferType convertManifest(File originalManifest, File convertedManifest) throws FileNotFoundException, IngestRejectException {
public ArchiveTransferType convertManifest(File originalManifest, File convertedManifest, String agency, Path propertiesFolder) throws FileNotFoundException, IngestRejectException {
this.rootFolder = Paths.get(originalManifest.getAbsolutePath()).getParent().resolve("DEPOT");
informationPackage.setDepositIdentifier(rootFolder.getParent().getFileName().toString());
try(InputStream inputStreamOriginal = new FileInputStream(originalManifest)) {
......@@ -307,6 +298,26 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
SAXSource source = new SAXSource(inFilter, is);
sip = (PacType) unmarshaller.unmarshal(source);
String planClassement = null;
if(sip.getDocMeta().getPlanClassement()!=null) {
planClassement = sip.getDocMeta().getPlanClassement().getValue();
}
//Chargement du bon fichier properties en utilisant le fichier de correspondance
String propertiesFileName = propertiesCorespondance(propertiesFolder.toString(), agency, planClassement );
properties = new Properties();
try {
properties.load(new FileInputStream(propertiesFolder + "/" + propertiesFileName));
} catch (FileNotFoundException e) {
System.err.println("Impossible de trouver le fichier propriétés " + propertiesFolder + "/" + propertiesFileName);
System.exit(-1);
} catch (IOException e) {
System.err.println("Impossible de lire le fichier propriétés " + propertiesFolder + "/" + propertiesFileName);
System.exit(-1);
}
// Saisie des donnees du fichier seda 2.1
archiveUnitCounter = 0;
......@@ -1936,14 +1947,16 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
}
if(listLang.contains(proposedLanguage)) {
if(listLang.contains("und")) {
//on oublie l'attribut und prévu initialement
/*if(listLang.contains("und")) {
elemSeda21.setLang(proposedLanguage);
setErrorLanguage(true);
//throw new DuplicateLanguageException(informationPackage.getDepositIdentifier(), DUPLICATE_ERROR_LANGUAGE, null);
} else {
listLang.add("und");
elemSeda21.setLang("und");
}
}*/
setErrorLanguage(true);
} else {
listLang.add(proposedLanguage);
elemSeda21.setLang(proposedLanguage);
......@@ -1994,7 +2007,52 @@ public class DCToSeda21Converter extends AbstractArchiveConverter {
//TODO : lever une exception car on n'a pas d'équivalent dans le fichier de référence
return null;
}
/**
* cherche le bon fichier properties pour un service versant et un filePlan donné
* puis retourne un tableau de string contenant les valeurs planClassement, sydtemId, descriptionLevel, title
* Dans le cas où il n'y a qu'un fichier properties pour un service versant, la valeur "/" est indiquée par défaut
*
* @param filePath
* @param agency
* @return
* @throws IOException
* @throws Exception
*/
private static String propertiesCorespondance(String filePath, String agency, String planClassement) throws IOException
{
BufferedReader br = new BufferedReader(new FileReader(filePath + "/correspondances_properties.csv"));
String ligne = null;
agency = agency.trim();
if (planClassement==null) {
planClassement = "/";
}
planClassement = planClassement.trim();
String defaultProperties = "";
while ((ligne = br.readLine()) != null)
{
String[] data = ligne.split("\t");
if (data.length == 3) {
String agencyFile = data[0].trim();
String planClassementFile = data[1].trim();
if(agency.equalsIgnoreCase(agencyFile) && planClassement.equalsIgnoreCase(planClassementFile)) {
return data[2];
} else if(agency.equalsIgnoreCase(agencyFile) && "/".equalsIgnoreCase(planClassementFile)) {
defaultProperties = data[2];
}
}
}
if(!defaultProperties.equals("")) {
return defaultProperties;
}
br.close();
//TODO : lever une exception car on n'a pas de fichier properties
return null;
}
public List<DataObjectMapper> getDataObjectMapper() {
return dataObjectMapper;
......
......@@ -58,10 +58,12 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
public static Logger logger = LoggerFactory.getLogger(Seda1ToSeda21TarMaker.class);
private String agencyPropertyFilePath;
private static String agency;
private String outputDir;
private static Path propertiesFolder;
private String errorLanguageDir;
private String sipType = "sip";
......@@ -75,8 +77,8 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
* @param formalism
* @param String path chemin vers le fichier de propriétés du service versant
*/
public DCToSeda21TarMaker(String path, String planClassementPath, String aipOrSip) {
this.agencyPropertyFilePath = path;
public DCToSeda21TarMaker(String agency, String planClassementPath, String aipOrSip) {
this.agency = agency;
this.sipType = aipOrSip;
this.planClassementPath = planClassementPath;
tarMaker = new TarMakerImpl();
......@@ -87,9 +89,10 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
}
}
public DCToSeda21TarMaker(String path, String planClassementPath) {
this.agencyPropertyFilePath = path;
public DCToSeda21TarMaker(String path, String planClassementPath, Path propertiesFolder) {
this.agency = path;
this.planClassementPath = planClassementPath;
this.propertiesFolder = propertiesFolder;
tarMaker = new TarMakerImpl();
}
......@@ -97,14 +100,14 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
System.out.println(args[0]);
String archiveFolder = args[0];
DCToSeda21TarMaker converter = new DCToSeda21TarMaker("", "", "");
File archiveSeda21 = converter.convert(Paths.get(archiveFolder).toAbsolutePath());
File archiveSeda21 = converter.convert(Paths.get(archiveFolder).toAbsolutePath(), agency, propertiesFolder);
System.out.println("Archive SEDA 2.1 Créé : " + archiveSeda21.getAbsolutePath());
}
public File convert(Path rootFolderDC) throws DuplicateLanguageException, IngestRejectException {
public File convert(Path rootFolderDC, String agency, Path propertiesFolder) throws DuplicateLanguageException, IngestRejectException {
ManifestConverter xmlConverter = new DCToSeda21Converter(this.getAgencyPropertyFilePath(), this.getPlanClassementPath());
ManifestConverter xmlConverter = new DCToSeda21Converter(this.getAgencyPropertyFilePath(), this.getPropertiesFolder(), this.getPlanClassementPath());
((AbstractArchiveConverter)xmlConverter).setSipType(this.sipType);
/**
* Le fichier du manifeste SEDA 2.1
......@@ -140,7 +143,7 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
try {
ArchiveTransferType archive = xmlConverter.convertManifest(archiveTransfer, manifest);
ArchiveTransferType archive = xmlConverter.convertManifest(archiveTransfer, manifest, agency, propertiesFolder);
// Création du répertoire Content
createContentFolder(rootFolderDC);
......@@ -233,11 +236,11 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
}
public String getAgencyPropertyFilePath() {
return agencyPropertyFilePath;
return agency;
}
public void setAgencyPropertyFilePath(String agencyPropertyFilePath) {
this.agencyPropertyFilePath = agencyPropertyFilePath;
this.agency = agencyPropertyFilePath;
}
@Override
......@@ -276,4 +279,13 @@ public class DCToSeda21TarMaker implements ArchiveConverter {
public void setErrorLanguageDir(String errorLanguageDir) {
this.errorLanguageDir = errorLanguageDir;
}
public Path getPropertiesFolder() {
return propertiesFolder;
}
public void setPropertiesFolder(Path propertiesFolder) {
this.propertiesFolder = propertiesFolder;
}
}
......@@ -5,6 +5,7 @@ package fr.cines.pac.converter;
import java.io.File;
import java.io.FileNotFoundException;
import java.nio.file.Path;
import fr.cines.pac.converter.exception.DuplicateLanguageException;
import fr.cines.pac.ingest.util.exception.IngestRejectException;
......@@ -26,7 +27,7 @@ public interface ManifestConverter {
* @return
* @throws IngestRejectException
*/
ArchiveTransferType convertManifest(File originalManifest, File convertedManifest) throws FileNotFoundException, DuplicateLanguageException, IngestRejectException;
ArchiveTransferType convertManifest(File originalManifest, File convertedManifest, String agency, Path propertiesFolder) throws FileNotFoundException, DuplicateLanguageException, IngestRejectException;
public boolean isOnlyManifest();
......
......@@ -156,7 +156,7 @@ public class Seda1ToSeda21Converter extends AbstractArchiveConverter {
validator = vf.createValidator();
}
public fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType convertManifest(File originalManifest, File convertedManifest) throws FileNotFoundException {
public fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType convertManifest(File originalManifest, File convertedManifest, String Agency, Path propertiesFolder) throws FileNotFoundException {
this.rootFolder = Paths.get(originalManifest.getAbsolutePath()).getParent();
InputStream inputStream = new FileInputStream(originalManifest);
try {
......
......@@ -63,11 +63,15 @@ public class Seda1ToSeda21TarMaker implements ArchiveConverter {
*/
private TarMaker tarMaker;
private static String agency;
private static Path propertiesFolder;
private String sipFileName;
public static Logger logger = LoggerFactory.getLogger(Seda1ToSeda21TarMaker.class);
public Seda1ToSeda21TarMaker() {
public Seda1ToSeda21TarMaker(String agency) {
tarMaker = new TarMakerImpl();
this.sipFileName = "ArchiveTransfer.xml";
}
......@@ -75,12 +79,12 @@ public class Seda1ToSeda21TarMaker implements ArchiveConverter {
public static void main(String[] args) throws DuplicateLanguageException, IngestRejectException {
System.out.println(args[0]);
String archiveFolder = args[0];
Seda1ToSeda21TarMaker converter = new Seda1ToSeda21TarMaker();
File archiveSeda21 = converter.convert(Paths.get(archiveFolder).toAbsolutePath());
Seda1ToSeda21TarMaker converter = new Seda1ToSeda21TarMaker("");
File archiveSeda21 = converter.convert(Paths.get(archiveFolder).toAbsolutePath(), agency, propertiesFolder);
System.out.println("Archive SEDA 2.1 Créé : " + archiveSeda21.getAbsolutePath());
}
public File convert(Path rootFolderSEDA1) throws DuplicateLanguageException, IngestRejectException {
public File convert(Path rootFolderSEDA1, String agency, Path propertiesFolder) throws DuplicateLanguageException, IngestRejectException {
ManifestConverter xmlConverter = new Seda1ToSeda21Converter();
......@@ -111,7 +115,7 @@ public class Seda1ToSeda21TarMaker implements ArchiveConverter {
try {
ArchiveTransferType archive = xmlConverter.convertManifest(archiveTransfer, manifest);
ArchiveTransferType archive = xmlConverter.convertManifest(archiveTransfer, manifest, agency, propertiesFolder);
// On renomme le répertoire racine en Content
renameContentFolder(rootFolderSEDA1);
for (Object dataObject : archive.getDataObjectPackage().getDataObjectGroupOrBinaryDataObjectOrPhysicalDataObject()) {
......
......@@ -33,8 +33,9 @@ public class Seda1ToSeda21TarMakerTest {
@Test
@Ignore
public void testCreateArchive() throws UnknownFormatException, DuplicateLanguageException, IngestRejectException {
Seda1ToSeda21TarMaker converter = new Seda1ToSeda21TarMaker();
String agency = "cines";
Path propertiesFolder = null;
Seda1ToSeda21TarMaker converter = new Seda1ToSeda21TarMaker(agency);
String filePath = getClass().getResource("/SEDA_OK_Generic/").getFile();
File file = new File(filePath);
if (!Files.exists(Paths.get(file.toURI()))) {
......@@ -45,7 +46,7 @@ public class Seda1ToSeda21TarMakerTest {
}
try {
converter.convert(rootFolderSEDA1);
converter.convert(rootFolderSEDA1, agency, propertiesFolder);
} catch (DuplicateLanguageException e) {
// TODO Auto-generated catch block
e.printStackTrace();
......
......@@ -26,6 +26,7 @@ import static org.junit.Assert.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.nio.file.Path;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
......@@ -57,12 +58,14 @@ public class DCToSeda21ConverterTest {
*/
@Test
public void testConvertManifest() throws FileNotFoundException, IngestRejectException {
String agency = "cines";
Path propertiesFolder = null;
File aip = new File(getClass().getResource("/aip.xml").getFile());
File manifest = new File("manifest.xml");
ManifestConverter converter = new DCToSeda21Converter(getClass().getResource("/ABES.properties").getFile(), "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
ManifestConverter converter = new DCToSeda21Converter(agency, propertiesFolder, "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
converter.setOnlyManifest(false);
converter.convertManifest(aip, manifest);
converter.convertManifest(aip, manifest, agency, propertiesFolder);
}
......@@ -74,12 +77,14 @@ public class DCToSeda21ConverterTest {
*/
@Test
public void testConvertManifestComplet() throws FileNotFoundException, IngestRejectException {
String agency = "cines";
Path propertiesFolder = null;
File aip = new File(getClass().getResource("/aip_complet.xml").getFile());
File manifest = new File("manifest_complet.xml");
ManifestConverter converter = new DCToSeda21Converter(getClass().getResource("/ABES.properties").getFile(), "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
ManifestConverter converter = new DCToSeda21Converter(agency, propertiesFolder, "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
converter.setOnlyManifest(true);
converter.convertManifest(aip, manifest);
converter.convertManifest(aip, manifest, agency, propertiesFolder);
}
......@@ -91,12 +96,14 @@ public class DCToSeda21ConverterTest {
*/
@Test
public void testConvertManifestSip() throws FileNotFoundException, IngestRejectException {
String agency = "cines";
Path propertiesFolder = null;
File aip = new File(getClass().getResource("/DC_GIF_OK/sip.xml").getFile());
File manifest = new File("manifest_sip.xml");
ManifestConverter converter = new DCToSeda21Converter(getClass().getResource("/ABES.properties").getFile(), "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
ManifestConverter converter = new DCToSeda21Converter(agency, propertiesFolder, "/home/marceteau/git/vitam-data-test/VITAM_CINES_CONNECTOR/tests_finalisation_DC/TEST_PDC.txt");
converter.setOnlyManifest(true);
converter.convertManifest(aip, manifest);
converter.convertManifest(aip, manifest, agency, propertiesFolder);
}
......
......@@ -35,6 +35,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.nio.file.Path;
import java.util.List;
import java.util.Locale;
......@@ -274,10 +275,12 @@ public class Seda1ConverterTest {
@Test
@Ignore
public void testConversionGeneric() throws FileNotFoundException, IngestRejectException {
String agency = "cines";
Path propertiesFolder = null;
ManifestConverter converter = new Seda1ToSeda21Converter();
File originalManifest = new File(getClass().getResource("/SEDA_OK_Generic/ArchiveTransfer.xml").getFile());
File manifest = new File("manifest.xml");
fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType ip = converter.convertManifest(originalManifest, manifest);
fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType ip = converter.convertManifest(originalManifest, manifest, agency, propertiesFolder);
assertEquals(2, ip.getDataObjectPackage().getDataObjectGroupOrBinaryDataObjectOrPhysicalDataObject().size());
// Vérification que le fichier obtenu est conforme au schéma RNG
XmlTool tool = new XmlRelaxNGTool(manifest);
......@@ -290,10 +293,12 @@ public class Seda1ConverterTest {
@Test
@Ignore
public void testConversionCdc() throws FileNotFoundException, IngestRejectException {
String agency = "cines";
Path propertiesFolder = null;
ManifestConverter converter = new Seda1ToSeda21Converter();
File originalManifest = new File(getClass().getResource("/PA_CC_ADMCO_V1.6_137/Archive.xml").getFile());
File manifest = new File("manifest.xml");
fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType ip = converter.convertManifest(originalManifest, manifest);
fr.gouv.culture.archivesdefrance.seda.v2.ArchiveTransferType ip = converter.convertManifest(originalManifest, manifest, agency, propertiesFolder);
assertEquals(18, ip.getDataObjectPackage().getDataObjectGroupOrBinaryDataObjectOrPhysicalDataObject().size());
// Vérification que le fichier obtenu est conforme au schéma RNG
XmlTool <