From e1458d760c5f78039597e94c2b4f2ee4d7353738 Mon Sep 17 00:00:00 2001 From: MBorne Date: Thu, 8 Aug 2024 17:38:34 +0200 Subject: [PATCH] refactor(test): validator-core - remove usage of XML models in tests (refs #351) --- .../validator/io/ModelReaderFactoryTest.java | 15 +- .../ign/validator/io/XmlModelReaderTest.java | 320 ------------------ .../normalize/TableNormalizerTest.java | 6 +- .../fr/ign/validator/tools/FileUtilsTest.java | 5 +- .../attribute/CharactersValidatorTest.java | 2 +- .../FilenameExistsValidatorTest.java | 10 +- .../DocumentFolderNameValidatorTest.java | 2 +- .../resources/config-xml/adresse/files.xml | 16 - .../config-xml/adresse/types/ADRESSE.xml | 24 -- .../config-xml/cnig_PLU_2014/files.xml | 228 ------------- .../cnig_PLU_2014/types/DOC_URBA.xml | 140 -------- .../cnig_PLU_2014/types/DOC_URBA_COM.xml | 24 -- .../cnig_PLU_2014/types/HABILLAGE_LIN.xml | 32 -- .../cnig_PLU_2014/types/HABILLAGE_PCT.xml | 31 -- .../cnig_PLU_2014/types/HABILLAGE_SURF.xml | 31 -- .../cnig_PLU_2014/types/HABILLAGE_TXT.xml | 68 ---- .../cnig_PLU_2014/types/INFO_LIN.xml | 70 ---- .../cnig_PLU_2014/types/INFO_PCT.xml | 69 ---- .../cnig_PLU_2014/types/INFO_SURF.xml | 101 ------ .../cnig_PLU_2014/types/PRESCRIPTION_LIN.xml | 91 ----- .../cnig_PLU_2014/types/PRESCRIPTION_PCT.xml | 88 ----- .../cnig_PLU_2014/types/PRESCRIPTION_SURF.xml | 109 ------ .../cnig_PLU_2014/types/ZONE_URBA.xml | 108 ------ .../resources/config-xml/geofla/files.xml | 24 -- .../config-xml/geofla/types/COMMUNE.xml | 121 ------- .../geofla/types/LIMITE_COMMUNE.xml | 24 -- .../config-xml/missing_feature_type/files.xml | 16 - .../config-xml/sample-document/files.xml | 25 -- .../sample-document/types/COMMUNE.xml | 30 -- .../sample-document/types/SIMPLE.xml | 37 -- .../expected_adresse_normalized.csv | 18 +- 31 files changed, 35 insertions(+), 1850 deletions(-) delete mode 100644 validator-core/src/test/java/fr/ign/validator/io/XmlModelReaderTest.java delete mode 100644 validator-core/src/test/resources/config-xml/adresse/files.xml delete mode 100644 validator-core/src/test/resources/config-xml/adresse/types/ADRESSE.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/files.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA_COM.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_LIN.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_PCT.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_SURF.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_TXT.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_LIN.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_PCT.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_SURF.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_LIN.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_PCT.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_SURF.xml delete mode 100644 validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/ZONE_URBA.xml delete mode 100644 validator-core/src/test/resources/config-xml/geofla/files.xml delete mode 100644 validator-core/src/test/resources/config-xml/geofla/types/COMMUNE.xml delete mode 100644 validator-core/src/test/resources/config-xml/geofla/types/LIMITE_COMMUNE.xml delete mode 100644 validator-core/src/test/resources/config-xml/missing_feature_type/files.xml delete mode 100644 validator-core/src/test/resources/config-xml/sample-document/files.xml delete mode 100644 validator-core/src/test/resources/config-xml/sample-document/types/COMMUNE.xml delete mode 100644 validator-core/src/test/resources/config-xml/sample-document/types/SIMPLE.xml diff --git a/validator-core/src/test/java/fr/ign/validator/io/ModelReaderFactoryTest.java b/validator-core/src/test/java/fr/ign/validator/io/ModelReaderFactoryTest.java index 88cb6a2d..43cb00c7 100644 --- a/validator-core/src/test/java/fr/ign/validator/io/ModelReaderFactoryTest.java +++ b/validator-core/src/test/java/fr/ign/validator/io/ModelReaderFactoryTest.java @@ -1,5 +1,7 @@ package fr.ign.validator.io; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.net.MalformedURLException; @@ -7,13 +9,22 @@ import org.junit.Test; +import fr.ign.validator.exception.InvalidModelException; + public class ModelReaderFactoryTest { @Test public void testXml() throws MalformedURLException { URL url = new URL("https://example.org/my-model.xml"); - ModelReader reader = ModelReaderFactory.createModelReader(url); - assertTrue(reader instanceof XmlModelReader); + RuntimeException thrown = null; + try { + ModelReaderFactory.createModelReader(url); + }catch(RuntimeException e){ + thrown = e; + } + assertNotNull(thrown); + assertTrue(thrown instanceof InvalidModelException); + assertEquals("Fail to load https://example.org/my-model.xml (XML model support has been removed, use JSON format)",thrown.getMessage()); } @Test diff --git a/validator-core/src/test/java/fr/ign/validator/io/XmlModelReaderTest.java b/validator-core/src/test/java/fr/ign/validator/io/XmlModelReaderTest.java deleted file mode 100644 index e50928a8..00000000 --- a/validator-core/src/test/java/fr/ign/validator/io/XmlModelReaderTest.java +++ /dev/null @@ -1,320 +0,0 @@ -package fr.ign.validator.io; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.util.Strings; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -import com.fasterxml.jackson.core.JsonProcessingException; - -import fr.ign.validator.exception.ModelNotFoundException; -import fr.ign.validator.model.AttributeConstraints; -import fr.ign.validator.model.AttributeType; -import fr.ign.validator.model.DocumentModel; -import fr.ign.validator.model.FeatureType; -import fr.ign.validator.model.FileModel; -import fr.ign.validator.model.FileModel.MandatoryMode; -import fr.ign.validator.model.TableModel; -import fr.ign.validator.model.file.SingleTableModel; -import fr.ign.validator.tools.ResourceHelper; - -public class XmlModelReaderTest { - - private ModelReader modelLoader; - - @Before - public void setUp() throws Exception { - modelLoader = new XmlModelReader(); - } - - /** - * Ensure that ModelNotFoundException are thrown if DocumentModel file doesn't - * exists - */ - @Test - public void testLoadDocumentModelFileNotFound() { - File configDir = ResourceHelper.getResourceFile(getClass(), "/config-xml"); - File documentModelPath = new File(configDir, "/not-found/files.xml"); - boolean thrown = false; - try { - modelLoader.loadDocumentModel(documentModelPath); - } catch (ModelNotFoundException e) { - Assert.assertTrue(e.getMessage().contains("/not-found/files.xml")); - thrown = true; - } - Assert.assertTrue("ModelNotFoundException excepted", thrown); - } - - /** - * Ensure that ModelNotFoundException are thrown if DocumentModel URL doesn't - * exists - * - * @throws MalformedURLException - */ - @Test - public void testLoadDocumentModelUrlNotFound() throws MalformedURLException { - URL documentModelUrl = new URL("https://example.local/not-found/files.xml"); - boolean thrown = false; - try { - modelLoader.loadDocumentModel(documentModelUrl); - } catch (ModelNotFoundException e) { - Assert.assertEquals("Model 'https://example.local/not-found/files.xml' not found", e.getMessage()); - thrown = true; - } - Assert.assertTrue("ModelNotFoundException excepted", thrown); - } - - /** - * Ensure that ModelNotFoundException are thrown if a FeatureType is missing - * - * @throws MalformedURLException - */ - @Test - public void testLoadDocumentModelFeatureTypeNotFound() throws MalformedURLException { - File documentModelPath = ResourceHelper.getResourceFile( - getClass(), "/config-xml/missing_feature_type/files.xml" - ); - boolean thrown = false; - try { - modelLoader.loadDocumentModel(documentModelPath); - } catch (ModelNotFoundException e) { - Assert.assertTrue(e.getMessage().contains("/missing_feature_type/types/MY_TABLE.xml' not found")); - thrown = true; - } - Assert.assertTrue("ModelNotFoundException excepted", thrown); - } - - /** - * Read cnig_PLU_2014 and performs regress test - * - * @throws JsonProcessingException - */ - @Test - public void testLoadDocumentModelCnigPlu2014() { - File documentModelPath = ResourceHelper.getResourceFile(getClass(), "/config-xml/cnig_PLU_2014/files.xml"); - DocumentModel documentModel = modelLoader.loadDocumentModel(documentModelPath); - assertIsValid(documentModel); - - Assert.assertEquals("cnig_PLU_2014", documentModel.getName()); - Assert.assertEquals(31, documentModel.getFileModels().size()); - } - - /** - * Read adresse model and performs regress test - * - * @throws JsonProcessingException - */ - @Test - public void testLoadDocumentModelAdresse() { - File documentModelPath = ResourceHelper.getResourceFile(getClass(), "/config-xml/adresse/files.xml"); - DocumentModel documentModel = modelLoader.loadDocumentModel(documentModelPath); - assertIsValid(documentModel); - - Assert.assertEquals("adresse", documentModel.getName()); - Assert.assertEquals(1, documentModel.getFileModels().size()); - - FileModel fileModel = documentModel.getFileModels().get(0); - Assert.assertEquals("ADRESSE", fileModel.getName()); - - Assert.assertTrue(fileModel instanceof SingleTableModel); - FeatureType featureType = ((TableModel) fileModel).getFeatureType(); - Assert.assertNotNull(featureType); - Assert.assertEquals(2, featureType.getAttributeCount()); - - int index = 0; - { - AttributeType attribute = featureType.getAttribute(index++); - Assert.assertEquals("ID", attribute.getName()); - Assert.assertEquals("String", attribute.getTypeName()); - Assert.assertTrue(attribute.getConstraints().isUnique()); - } - { - AttributeType attribute = featureType.getAttribute(index++); - Assert.assertEquals("ADRESSE", attribute.getName()); - Assert.assertEquals("String", attribute.getTypeName()); - Assert.assertFalse(attribute.getConstraints().isUnique()); - } - } - - /** - * Load DocumentModel /config-xml/sample-document/files.xml and performs checks - */ - @Test - public void testLoadDocumentModelSampleDocument() { - File documentModelPath = ResourceHelper.getResourceFile(getClass(), "/config-xml/sample-document/files.xml"); - DocumentModel documentModel = modelLoader.loadDocumentModel(documentModelPath); - assertIsValid(documentModel); - - // name - Assert.assertEquals("ccccc_CC_dddddddd", documentModel.getName()); - // DocumentContraints - Assert.assertEquals( - "[0-9]{5}_CC_[0-9]{8}", - documentModel.getConstraints().getFolderName() - ); - Assert.assertNull( - documentModel.getConstraints().getMetadataSpecification() - ); - - // fileModels - Assert.assertEquals(3, documentModel.getFileModels().size()); - int index = 0; - { - FileModel fileModel = documentModel.getFileModels().get(index++); - Assert.assertEquals("SIMPLE", fileModel.getName()); - Assert.assertTrue(fileModel instanceof SingleTableModel); - FeatureType featureType = ((TableModel) fileModel).getFeatureType(); - Assert.assertNotNull(featureType); - Assert.assertEquals(MandatoryMode.WARN, fileModel.getMandatory()); - Assert.assertEquals("SIMPLE", featureType.getName()); - } - { - FileModel fileModel = documentModel.getFileModels().get(index++); - Assert.assertEquals("Donnees_geographiques", fileModel.getName()); - Assert.assertEquals(MandatoryMode.ERROR, fileModel.getMandatory()); - } - { - FileModel fileModel = documentModel.getFileModels().get(index++); - Assert.assertEquals("COMMUNE", fileModel.getName()); - Assert.assertEquals(MandatoryMode.WARN, fileModel.getMandatory()); - - Assert.assertTrue(fileModel instanceof SingleTableModel); - FeatureType featureType = ((TableModel) fileModel).getFeatureType(); - Assert.assertNotNull(featureType); - Assert.assertEquals("COMMUNE", featureType.getName()); - assertExceptedFeatureTypeCommune(featureType); - } - } - - /** - * Check FeatureType definition for - * /config-xml/sample-document/types/COMMUNE.xml - * - * @param featureType - */ - private void assertExceptedFeatureTypeCommune(FeatureType featureType) { - int index = 0; - { - AttributeType attributeType = featureType.getAttribute(index++); - Assert.assertEquals("INSEE", attributeType.getName()); - Assert.assertEquals("String", attributeType.getTypeName()); - AttributeConstraints contraints = attributeType.getConstraints(); - Assert.assertEquals(true, contraints.isRequired()); - Assert.assertEquals(true, contraints.isUnique()); - Assert.assertEquals("[0-9]{5}", contraints.getPattern()); - Assert.assertNull(contraints.getReference()); - Assert.assertNull(contraints.getEnumValues()); - } - { - AttributeType attributeType = featureType.getAttribute(index++); - Assert.assertEquals("CODE_DEPT", attributeType.getName()); - Assert.assertEquals("String", attributeType.getTypeName()); - AttributeConstraints constraints = attributeType.getConstraints(); - Assert.assertEquals(true, constraints.isRequired()); - Assert.assertNull(constraints.getPattern()); - Assert.assertEquals(false, constraints.isUnique()); - Assert.assertNull(constraints.getReference()); - Assert.assertNotNull(constraints.getEnumValues()); - Assert.assertEquals("01,02", Strings.join(constraints.getEnumValues(), ',')); - } - { - AttributeType attributeType = featureType.getAttribute(index++); - Assert.assertEquals("DETRUIT", attributeType.getName()); - Assert.assertEquals("Boolean", attributeType.getTypeName()); - AttributeConstraints constraints = attributeType.getConstraints(); - Assert.assertEquals(false, constraints.isRequired()); - Assert.assertNull(constraints.getPattern()); - Assert.assertEquals(false, constraints.isUnique()); - Assert.assertNull(constraints.getReference()); - Assert.assertNull(constraints.getEnumValues()); - } - } - - @Test - public void testLoadFeatureTypeWithCDATA() { - File srcFile = ResourceHelper.getResourceFile(getClass(), "/config-xml/sample-document/types/SIMPLE.xml"); - - FeatureType featureType = modelLoader.loadFeatureType(srcFile); - Assert.assertEquals("SIMPLE", featureType.getName()); - Assert.assertEquals("TABLE TEST", featureType.getDescription()); - Assert.assertEquals(3, featureType.getAttributeCount()); - Assert.assertTrue(featureType.isSpatial()); - - int index = 0; - { - AttributeType attribute = featureType.getAttribute(index++); - Assert.assertEquals("ID", attribute.getName()); - Assert.assertEquals("Integer", attribute.getTypeName()); - - AttributeConstraints constraints = attribute.getConstraints(); - Assert.assertTrue(constraints.isRequired()); - Assert.assertFalse(constraints.isUnique()); - Assert.assertNull(constraints.getPattern()); - Assert.assertNull(constraints.getEnumValues()); - } - - { - AttributeType attribute = featureType.getAttribute(index++); - Assert.assertEquals("NAME", attribute.getName()); - Assert.assertEquals("String", attribute.getTypeName()); - - AttributeConstraints constraints = attribute.getConstraints(); - Assert.assertTrue(constraints.isRequired()); - Assert.assertFalse(constraints.isUnique()); - Assert.assertNull(constraints.getPattern()); - Assert.assertNull(constraints.getEnumValues()); - } - - { - AttributeType attribute = featureType.getAttribute(index++); - Assert.assertEquals("GEOMETRY", attribute.getName()); - Assert.assertEquals("Geometry", attribute.getTypeName()); - - AttributeConstraints constraints = attribute.getConstraints(); - Assert.assertFalse(constraints.isRequired()); - Assert.assertFalse(constraints.isUnique()); - Assert.assertNull(constraints.getPattern()); - Assert.assertNull(constraints.getEnumValues()); - } - - } - - /** - * Performs basic consistency checks on DocumentModel - * - * @param documentModel - */ - private void assertIsValid(DocumentModel documentModel) { - List fileModels = documentModel.getFileModels(); - for (FileModel fileModel : fileModels) { - Assert.assertNotNull(fileModel.getName()); - Assert.assertNotNull(fileModel.getMandatory()); - if (fileModel instanceof SingleTableModel) { - FeatureType featureType = ((TableModel) fileModel).getFeatureType(); - Assert.assertNotNull(featureType); - assertIsValid(featureType); - } - } - } - - /** - * Performs basic consistency checks on FeatureType - * - * @param documentModel - */ - private void assertIsValid(FeatureType featureType) { - Assert.assertFalse(StringUtils.isEmpty(featureType.getName())); - - Assert.assertFalse( - "featureType must have at least one attribute", - featureType.getAttributeCount() == 0 - ); - } - -} diff --git a/validator-core/src/test/java/fr/ign/validator/normalize/TableNormalizerTest.java b/validator-core/src/test/java/fr/ign/validator/normalize/TableNormalizerTest.java index 65cecc85..2c60ce87 100644 --- a/validator-core/src/test/java/fr/ign/validator/normalize/TableNormalizerTest.java +++ b/validator-core/src/test/java/fr/ign/validator/normalize/TableNormalizerTest.java @@ -12,8 +12,8 @@ import fr.ign.validator.Context; import fr.ign.validator.data.Document; +import fr.ign.validator.io.JsonModelReader; import fr.ign.validator.io.ModelReader; -import fr.ign.validator.io.XmlModelReader; import fr.ign.validator.model.DocumentModel; import fr.ign.validator.model.FeatureType; import fr.ign.validator.model.FileModel; @@ -42,8 +42,8 @@ public void setUp() throws Exception { context.setProjection(Projection.CODE_CRS84); context.setReportBuilder(reportBuilder); - File documentModelPath = ResourceHelper.getResourceFile(getClass(), "/config-xml/adresse/files.xml"); - ModelReader modelLoader = new XmlModelReader(); + File documentModelPath = ResourceHelper.getResourceFile(getClass(), "/config-json/adresse/files.json"); + ModelReader modelLoader = new JsonModelReader(); DocumentModel documentModel = modelLoader.loadDocumentModel(documentModelPath); File documentPath = ResourceHelper.getResourceFile(getClass(), "/documents/adresse-multiple"); diff --git a/validator-core/src/test/java/fr/ign/validator/tools/FileUtilsTest.java b/validator-core/src/test/java/fr/ign/validator/tools/FileUtilsTest.java index 776578bc..6242adc0 100644 --- a/validator-core/src/test/java/fr/ign/validator/tools/FileUtilsTest.java +++ b/validator-core/src/test/java/fr/ign/validator/tools/FileUtilsTest.java @@ -11,12 +11,13 @@ public class FileUtilsTest { @Test public void testListFilesAndDirs() { - File directory = ResourceHelper.getResourceFile(getClass(), "/config-xml/geofla"); + File directory = ResourceHelper.getResourceFile(getClass(), "/documents/commune-sample"); String[] extensions = { "xml" }; Collection files = FileUtils.listFilesAndDirs(directory, extensions); - assertEquals(4, files.size()); + // 2 XML files and 1 sub-directory + assertEquals(3, files.size()); } } diff --git a/validator-core/src/test/java/fr/ign/validator/validation/attribute/CharactersValidatorTest.java b/validator-core/src/test/java/fr/ign/validator/validation/attribute/CharactersValidatorTest.java index 9dbf22d0..9835c0c9 100644 --- a/validator-core/src/test/java/fr/ign/validator/validation/attribute/CharactersValidatorTest.java +++ b/validator-core/src/test/java/fr/ign/validator/validation/attribute/CharactersValidatorTest.java @@ -28,7 +28,7 @@ public void setUp() throws Exception { context = new Context(); context.setStringFixer(StringFixer.createFullStringFixer(StandardCharsets.ISO_8859_1)); - File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/config-xml/geofla"); + File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/documents/adresse-multiple"); context.setCurrentDirectory(currentDirectory); report = new InMemoryReportBuilder(); diff --git a/validator-core/src/test/java/fr/ign/validator/validation/attribute/FilenameExistsValidatorTest.java b/validator-core/src/test/java/fr/ign/validator/validation/attribute/FilenameExistsValidatorTest.java index 18c689d1..7c784932 100644 --- a/validator-core/src/test/java/fr/ign/validator/validation/attribute/FilenameExistsValidatorTest.java +++ b/validator-core/src/test/java/fr/ign/validator/validation/attribute/FilenameExistsValidatorTest.java @@ -23,7 +23,7 @@ public void setUp() throws Exception { validator = new FilenameExistsValidator(); context = new Context(); - File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/config-xml/geofla"); + File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/documents/commune-sample"); context.setCurrentDirectory(currentDirectory); report = new InMemoryReportBuilder(); @@ -33,7 +33,7 @@ public void setUp() throws Exception { @Test public void testExisting() { PathType type = new PathType(); - Attribute attribute = new Attribute(type, new File("files.xml")); + Attribute attribute = new Attribute(type, new File("commune.csv")); validator.validate(context, attribute); Assert.assertEquals(0, report.countErrors()); } @@ -41,7 +41,7 @@ public void testExisting() { @Test public void testExistingWithFragment() { PathType type = new PathType(); - Attribute attribute = new Attribute(type, new File("files.xml#page=15")); + Attribute attribute = new Attribute(type, new File("commune.csv#page=15")); validator.validate(context, attribute); Assert.assertEquals(0, report.countErrors()); } @@ -49,7 +49,7 @@ public void testExistingWithFragment() { @Test public void testExistingInSubdirectory() { PathType type = new PathType(); - Attribute attribute = new Attribute(type, new File("COMMUNE.xml")); + Attribute attribute = new Attribute(type, new File("a_file.pdf")); validator.validate(context, attribute); Assert.assertEquals(0, report.countErrors()); } @@ -57,7 +57,7 @@ public void testExistingInSubdirectory() { @Test public void testExistingInSubdirectoryWithFragment() { PathType type = new PathType(); - Attribute attribute = new Attribute(type, new File("COMMUNE.xml#page=15")); + Attribute attribute = new Attribute(type, new File("a_file.pdf#page=15")); validator.validate(context, attribute); Assert.assertEquals(0, report.countErrors()); } diff --git a/validator-core/src/test/java/fr/ign/validator/validation/document/DocumentFolderNameValidatorTest.java b/validator-core/src/test/java/fr/ign/validator/validation/document/DocumentFolderNameValidatorTest.java index 761a75b7..d7027739 100644 --- a/validator-core/src/test/java/fr/ign/validator/validation/document/DocumentFolderNameValidatorTest.java +++ b/validator-core/src/test/java/fr/ign/validator/validation/document/DocumentFolderNameValidatorTest.java @@ -23,7 +23,7 @@ public void setUp() throws Exception { validator = new DocumentFolderNameValidator(); context = new Context(); - File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/config-xml/geofla"); + File currentDirectory = ResourceHelper.getResourceFile(getClass(), "/documents/commune-sample"); context.setCurrentDirectory(currentDirectory); report = new InMemoryReportBuilder(); diff --git a/validator-core/src/test/resources/config-xml/adresse/files.xml b/validator-core/src/test/resources/config-xml/adresse/files.xml deleted file mode 100644 index 6c07922a..00000000 --- a/validator-core/src/test/resources/config-xml/adresse/files.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/validator-core/src/test/resources/config-xml/adresse/types/ADRESSE.xml b/validator-core/src/test/resources/config-xml/adresse/types/ADRESSE.xml deleted file mode 100644 index 868f5c9c..00000000 --- a/validator-core/src/test/resources/config-xml/adresse/types/ADRESSE.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - 20 - false - true - - - - - - - 254 - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/files.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/files.xml deleted file mode 100644 index 45805287..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/files.xml +++ /dev/null @@ -1,228 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA.xml deleted file mode 100644 index f631f6c9..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA.xml +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - 4 - false - - - - - - - - - - - - - 254 - true - - - - - - - 2 - false - - - - - - - - - - - - - - - - 1 - true - - - - - - - - - - - 80 - true - - - - - - - 2 - true - - - - - - - - - - - 80 - true - - - - - - - 20 - false - - - - - - - 254 - true - - - - - - - 254 - true - - - - - - - true - - - - - - - true - - - - - - - 9 - true - - - - - - - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA_COM.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA_COM.xml deleted file mode 100644 index 38d35cbf..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/DOC_URBA_COM.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - 20 - true - - - - - - - 5 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_LIN.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_LIN.xml deleted file mode 100644 index 15f1751a..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_LIN.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - 5 - false - - - - - - - 40 - true - - - - - - - -1 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_PCT.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_PCT.xml deleted file mode 100644 index 83b00a8b..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_PCT.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - 5 - false - - - - - - - false - - - - - - - 40 - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_SURF.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_SURF.xml deleted file mode 100644 index b3466121..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_SURF.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - 40 - true - - - - - - - false - - - - - - - 5 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_TXT.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_TXT.xml deleted file mode 100644 index 868d4796..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/HABILLAGE_TXT.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - 40 - false - - - - - - - 40 - true - - - - - - - 5 - false - - - - - - - false - - - - - - - true - - - - - - - false - - - - - - - 80 - false - - - - - - - 40 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_LIN.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_LIN.xml deleted file mode 100644 index 9ba31603..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_LIN.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - 5 - false - - - - - - - 10 - true - - - - - - - 254 - false - - - - - - - 254 - true - - - - - - - 2 - false - - - - - - - - - - - - - - false - - - - - - - 80 - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_PCT.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_PCT.xml deleted file mode 100644 index 50b6a028..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_PCT.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - 80 - true - - - - - - - false - - - - - - - 254 - true - - - - - - - 2 - false - - - - - - - - - - - - - 254 - false - - - - - - - 10 - true - - - - - - - 5 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_SURF.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_SURF.xml deleted file mode 100644 index 724a8bd8..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/INFO_SURF.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - 5 - false - - - - - - - 2 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - true - - - - - - - false - - - - - - - 254 - false - - - - - - - 80 - true - - - - - - - 254 - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_LIN.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_LIN.xml deleted file mode 100644 index a53aadc7..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_LIN.xml +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - - - - - - true - - - - - - - false - - - - - - - 10 - true - - - - - - - 254 - false - - - - - - - 5 - false - - - - - - - 254 - true - - - - - - - 80 - true - - - - - - - 2 - false - - - - - - - - - - - - - - - - - - - - - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_PCT.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_PCT.xml deleted file mode 100644 index b0206859..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_PCT.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - false - - - - - - - 80 - true - - - - - - - 254 - false - - - - - - - 2 - false - - - - - - - - - - - - - - - - - - 5 - false - - - - - - - true - - - - - - - true - - - - - - - 254 - true - - - - - - - 10 - true - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_SURF.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_SURF.xml deleted file mode 100644 index c1e1c495..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/PRESCRIPTION_SURF.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - 254 - true - - - - - - - true - - - - - - - true - - - - - - - 80 - true - - - - - - - 2 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 254 - false - - - - - - - 10 - true - - - - - - - false - - - - - - - 5 - false - - - diff --git a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/ZONE_URBA.xml b/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/ZONE_URBA.xml deleted file mode 100644 index ce9ed74d..00000000 --- a/validator-core/src/test/resources/config-xml/cnig_PLU_2014/types/ZONE_URBA.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - 2 - false - - - - - - - - - - - - - - - - - - - - 5 - false - - - - - - - 254 - true - - - - - - - 80 - true - - - - - - - 254 - true - - - - - - - 3 - false - - - - - - - - - - - - - - - - - true - - - - - - - true - - - - - - - 12 - false - - - - - - - false - - - diff --git a/validator-core/src/test/resources/config-xml/geofla/files.xml b/validator-core/src/test/resources/config-xml/geofla/files.xml deleted file mode 100644 index 5ca355a9..00000000 --- a/validator-core/src/test/resources/config-xml/geofla/files.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - 788 - - - - - 8766 - - - - - OPTIONAL - - - 8766 - - - - - OPTIONAL - - - diff --git a/validator-core/src/test/resources/config-xml/geofla/types/COMMUNE.xml b/validator-core/src/test/resources/config-xml/geofla/types/COMMUNE.xml deleted file mode 100644 index 09624924..00000000 --- a/validator-core/src/test/resources/config-xml/geofla/types/COMMUNE.xml +++ /dev/null @@ -1,121 +0,0 @@ - - - COMMUNE - - - GEOMETRY - Geometry - GEOMETRY - false - - - ID_GEOFLA - String - ID_GEOFLA - false - - - CODE_COM - String - CODE_COM - false - - - INSEE_COM - String - INSEE_COM - false - - - NOM_COM - String - NOM_COM - false - - - STATUT - String - STATUT - false - - - X_CHF_LIEU - String - X_CHF_LIEU - false - - - Y_CHF_LIEU - String - Y_CHF_LIEU - false - - - X_CENTROID - String - X_CENTROID - false - - - Y_CENTROID - String - Y_CENTROID - false - - - Z_MOYEN - String - Z_MOYEN - false - - - SUPERFICIE - String - SUPERFICIE - false - - - POPULATION - String - POPULATION - false - - - CODE_CANT - String - CODE_CANT - false - - - CODE_ARR - String - CODE_ARR - false - - - CODE_DEPT - String - CODE_DEPT - false - - - NOM_DEPT - String - NOM_DEPT - false - - - CODE_REG - String - CODE_REG - false - - - NOM_REG - String - NOM_REG - false - - - - diff --git a/validator-core/src/test/resources/config-xml/geofla/types/LIMITE_COMMUNE.xml b/validator-core/src/test/resources/config-xml/geofla/types/LIMITE_COMMUNE.xml deleted file mode 100644 index fd0345b6..00000000 --- a/validator-core/src/test/resources/config-xml/geofla/types/LIMITE_COMMUNE.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - LIMITE_COMMUNE - - - GEOMETRY - Geometry - GEOMETRY - false - - - ID_GEOFLA - String - ID_GEOFLA - false - - - NATURE - String - NATURE - false - - - \ No newline at end of file diff --git a/validator-core/src/test/resources/config-xml/missing_feature_type/files.xml b/validator-core/src/test/resources/config-xml/missing_feature_type/files.xml deleted file mode 100644 index 14a72dc9..00000000 --- a/validator-core/src/test/resources/config-xml/missing_feature_type/files.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/validator-core/src/test/resources/config-xml/sample-document/files.xml b/validator-core/src/test/resources/config-xml/sample-document/files.xml deleted file mode 100644 index 2c5ff628..00000000 --- a/validator-core/src/test/resources/config-xml/sample-document/files.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - ccccc_CC_dddddddd - [0-9]{5}_CC_[0-9]{8} - - - SIMPLE - table - (N_)?SIMPLE(_(02A|02B|[0-9]{3}))? - WARN - - - Donnees_geographiques - directory - Donnees_geographiques - ERROR - - - COMMUNE - table - Donnees_geographiques/(N_)?COMMUNE(_[0-9]{5})?(_(02A|02B|[0-9]{3}))? - WARN - - - diff --git a/validator-core/src/test/resources/config-xml/sample-document/types/COMMUNE.xml b/validator-core/src/test/resources/config-xml/sample-document/types/COMMUNE.xml deleted file mode 100644 index 90fd523a..00000000 --- a/validator-core/src/test/resources/config-xml/sample-document/types/COMMUNE.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - COMMUNE - La table des communes - - - INSEE - String - [0-9]{5} - false - true - - - CODE_DEPT - String - false - false - - 01 - 02 - - - - DETRUIT - Boolean - true - false - - - diff --git a/validator-core/src/test/resources/config-xml/sample-document/types/SIMPLE.xml b/validator-core/src/test/resources/config-xml/sample-document/types/SIMPLE.xml deleted file mode 100644 index 93b5ce43..00000000 --- a/validator-core/src/test/resources/config-xml/sample-document/types/SIMPLE.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 64594 - - - - - 130278 - - - - false - - - 130279 - - - - false - - - 130280 - - - true - - - - 786 - - - - - - - - diff --git a/validator-core/src/test/resources/normalizer/expected_adresse_normalized.csv b/validator-core/src/test/resources/normalizer/expected_adresse_normalized.csv index 0f0e3e36..2fa253cb 100644 --- a/validator-core/src/test/resources/normalizer/expected_adresse_normalized.csv +++ b/validator-core/src/test/resources/normalizer/expected_adresse_normalized.csv @@ -1,9 +1,9 @@ -ID,ADRESSE -1,"adresse bidon, Paris" -5,"adresse du 15ième, Paris" -2,"adresse au soleil, Montpellier" -3,"adresse sympa, Montpellier" -4,"adresse sous la pluie, Brest" -7,"adresse d'un pub, Brest" -6, -7, +ID,ADRESSE,HOMEPAGE +1,"adresse bidon, Paris", +5,"adresse du 15ième, Paris", +2,"adresse au soleil, Montpellier", +3,"adresse sympa, Montpellier", +4,"adresse sous la pluie, Brest", +7,"adresse d'un pub, Brest", +6,, +7,,