Skip to content
Snippets Groups Projects
Commit 501c5bf8 authored by unknown's avatar unknown
Browse files

[java] correction PR

parent 472599ba
No related branches found
No related tags found
1 merge request!28Nouveau mis a jour Vitamui
Showing
with 95 additions and 440 deletions
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
<!-- VITAMUI --> <!-- VITAMUI -->
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-api</artifactId>
</dependency>
<dependency> <dependency>
<groupId>fr.gouv.vitamui.commons</groupId> <groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-rest</artifactId> <artifactId>commons-rest</artifactId>
...@@ -50,54 +45,6 @@ ...@@ -50,54 +45,6 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<!-- TEST -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-test</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
</dependencies> </dependencies>
......
...@@ -57,19 +57,5 @@ public class CardinalityTagFactory implements AbstractTagFactory<CardinalityTag> ...@@ -57,19 +57,5 @@ public class CardinalityTagFactory implements AbstractTagFactory<CardinalityTag>
return cardinality; return cardinality;
} }
public RNGConstants.Cardinality checkCardinalityType(String cardinalityType) {
RNGConstants.Cardinality enumerationRngConstantsCardinality= null;
if (cardinalityType.equals("ZeroOrMoreTag")) {
enumerationRngConstantsCardinality = RNGConstants.Cardinality.ZERO_OR_MORE;
}
if (cardinalityType.equals("OneOrMoreTag")) {
enumerationRngConstantsCardinality = RNGConstants.Cardinality.ONE_OR_MORE;
}
if (cardinalityType.equals("OptionalTag")) {
enumerationRngConstantsCardinality = RNGConstants.Cardinality.OPTIONAL;
}
return enumerationRngConstantsCardinality;
}
} }
...@@ -47,14 +47,6 @@ public class PuaMetadata extends JsonElement { ...@@ -47,14 +47,6 @@ public class PuaMetadata extends JsonElement {
private Map<String, PuaMetadataDetails> puaDetails = new HashMap<>(); private Map<String, PuaMetadataDetails> puaDetails = new HashMap<>();
public Map<String, PuaMetadataDetails> getPuaDetails() {
return puaDetails;
}
public void setPuaDetails(Map<String, PuaMetadataDetails> puaDetails) {
this.puaDetails = puaDetails;
}
@Override @Override
public JsonElement deepCopy() { public JsonElement deepCopy() {
return null; return null;
......
/*
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2021)
[dad@cines.fr]
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
profiles based on the french SEDA standard
(https://redirect.francearchives.fr/seda/).
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
*/
package fr.gouv.vitamui.pastis.common.service;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class PuaDefinitions {
protected Map<String, Object> definitions;
@Value("${pua.definitions.file}")
private String defintionsFile;
@JsonAnyGetter
public Map<String, Object> getDefinitions() {
return definitions;
}
@JsonAnySetter
public void setDefinitions(String key, Object value) {
if (definitions == null) {
definitions = new HashMap<>();
}
if (key != null) {
if (value != null) {
definitions.put(key, value);
} else {
definitions.remove(key);
}
}
}
}
...@@ -54,8 +54,12 @@ public class PuaFromJSON { ...@@ -54,8 +54,12 @@ public class PuaFromJSON {
private static final String SCHEMA = "http://json-schema.org/draft-04/schema"; private static final String SCHEMA = "http://json-schema.org/draft-04/schema";
private static final String TYPE = "object"; private static final String TYPE = "object";
private static final Boolean ADDITIONALPROPERTIES = false; private static final Boolean ADDITIONALPROPERTIES = false;
private final PuaPastisValidator puaPastisValidator;
@Autowired @Autowired
private PuaPastisValidator puaPastisValidator; public PuaFromJSON(final PuaPastisValidator puaPastisValidator){
this.puaPastisValidator = puaPastisValidator;
}
public String getControlSchemaFromElementProperties(ElementProperties elementProperties) throws IOException { public String getControlSchemaFromElementProperties(ElementProperties elementProperties) throws IOException {
// We use a JSONObject instead of POJO, since Jackson and Gson will add unnecessary // We use a JSONObject instead of POJO, since Jackson and Gson will add unnecessary
......
...@@ -38,9 +38,12 @@ knowledge of the CeCILL-C license and that you accept its terms. ...@@ -38,9 +38,12 @@ knowledge of the CeCILL-C license and that you accept its terms.
package fr.gouv.vitamui.pastis.common.util; package fr.gouv.vitamui.pastis.common.util;
import lombok.Getter;
import lombok.Setter;
import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.ByteArrayResource;
import org.springframework.lang.Nullable; import org.springframework.lang.Nullable;
@Getter@Setter
public final class FileSystemResource extends ByteArrayResource { public final class FileSystemResource extends ByteArrayResource {
private String fileName; private String fileName;
...@@ -50,11 +53,6 @@ public final class FileSystemResource extends ByteArrayResource { ...@@ -50,11 +53,6 @@ public final class FileSystemResource extends ByteArrayResource {
this.fileName = filename; this.fileName = filename;
} }
@Override
public String getFilename() {
return fileName;
}
@Override @Override
public int hashCode() { public int hashCode() {
return super.hashCode(); return super.hashCode();
...@@ -65,8 +63,4 @@ public final class FileSystemResource extends ByteArrayResource { ...@@ -65,8 +63,4 @@ public final class FileSystemResource extends ByteArrayResource {
return super.equals(other); return super.equals(other);
} }
public void setFilename(String fileName) {
this.fileName = fileName;
}
} }
/*
Copyright © CINES - Centre Informatique National pour l'Enseignement Supérieur (2021)
[dad@cines.fr]
This software is a computer program whose purpose is to provide
a web application to create, edit, import and export archive
profiles based on the french SEDA standard
(https://redirect.francearchives.fr/seda/).
This software is governed by the CeCILL-C license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL-C
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms.
*/
package fr.gouv.vitamui.pastis.common.util;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.json.JSONObject;
import java.lang.reflect.Field;
import java.util.LinkedHashMap;
public class OrderedJSONObjectFactory {
private static final Logger LOGGER = LoggerFactory.getLogger(OrderedJSONObjectFactory.class);
private static boolean setupDone = false;
private static Field jsonObjectMapField = null;
private OrderedJSONObjectFactory() {}
public static void setupFieldAccessor() {
if (!setupDone) {
setupDone = true;
try {
jsonObjectMapField = JSONObject.class.getDeclaredField("map");
jsonObjectMapField.setAccessible(true);
} catch (NoSuchFieldException ignored) {
LOGGER.warn("JSONObject implementation has changed, returning unmodified instance");
}
}
}
public static JSONObject create() {
setupFieldAccessor();
JSONObject result = new JSONObject();
try {
if (jsonObjectMapField != null) {
jsonObjectMapField.set(result, new LinkedHashMap<>());
}
} catch (IllegalAccessException e) {
LOGGER.info(e.getMessage());
}
return result;
}
}
...@@ -65,60 +65,4 @@ public class PastisGetXmlJsonTree { ...@@ -65,60 +65,4 @@ public class PastisGetXmlJsonTree {
return ElementRNG.getElementStaticRoot(); return ElementRNG.getElementStaticRoot();
} }
// Test an xml to json and a json to xml.
public String getJsonParsedTreeTest(ElementRNG elementRNGRoot) throws JAXBException, FileNotFoundException {
//vWhen the handler is called, the proprities tree (json) is build
// using its ElementRNG(elementRngRoot) object.
// The elementRngRoot is filled when the xml file is read, by passing
// it to the contentHanler of the Xml reader.
// The methods used are the 5 main methods of a DefaultHandler type
// See methods bellow
ElementRNG.buildElementPropertiesTree(elementRNGRoot, 0, null);
ElementProperties eparent = ElementRNG.getElementStaticRoot();
// The eparentRng is an object of type BalizeXML. It is built using the
// object eparent (of type ElementProperties) that, in fact, represent the json
// prouced during the parser's first call.
BaliseXML.buildBaliseXMLTree(eparent, 0, null);
BaliseXML eparentRng = BaliseXML.getBaliseXMLStatic();
// Transforms java objects to Xml file (Marshalling)
JAXBContext contextObj =
JAXBContext.newInstance(AttributeXML.class, ElementXML.class, DataXML.class, ValueXML.class,
OptionalXML.class, OneOrMoreXML.class,
ZeroOrMoreXML.class, AnnotationXML.class, DocumentationXML.class, ChoiceXml.class);
Marshaller marshallerObj = contextObj.createMarshaller();
marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshallerObj.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler",
new PastisCustomCharacterEscapeHandler());
marshallerObj.marshal(eparentRng, new FileOutputStream("generated_test.xml"));
ObjectMapper mapper = new ObjectMapper();
String jsonString = "";
try {
jsonString = mapper.writeValueAsString(eparent);
} catch (JsonGenerationException e1) {
LOGGER.info("JsonGenerationException", e1);
} catch (JsonMappingException e1) {
LOGGER.info("JsonMappingException", e1);
} catch (IOException e1) {
LOGGER.info("IOException", e1);
}
return "[" + jsonString + "]";
}
public String getXmlParsedTree(String jsonString) throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
ObjectMapper xmlMapper = new ObjectMapper();
JsonNode tree = objectMapper.readTree(jsonString);
return xmlMapper.writeValueAsString(tree);
}
} }
...@@ -43,15 +43,14 @@ import org.xml.sax.Attributes; ...@@ -43,15 +43,14 @@ import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; import org.xml.sax.helpers.DefaultHandler;
import java.util.ArrayDeque; import java.util.Stack;
import java.util.Deque;
public class PastisSAX2Handler extends DefaultHandler { public class PastisSAX2Handler extends DefaultHandler {
@Getter @Getter
private ElementRNG elementRNGRoot; private ElementRNG elementRNGRoot;
boolean isValue; boolean isValue;
private Deque<ElementRNG> stackRNG = new ArrayDeque<>(); private Stack<ElementRNG> stackRNG = new Stack<>();
private boolean isInDocumentationTag; private boolean isInDocumentationTag;
private StringBuilder documentationContent; private StringBuilder documentationContent;
...@@ -81,7 +80,7 @@ public class PastisSAX2Handler extends DefaultHandler { ...@@ -81,7 +80,7 @@ public class PastisSAX2Handler extends DefaultHandler {
elementRNG.setType(localName); elementRNG.setType(localName);
elementRNG.setDataType(attr.getValue("type")); elementRNG.setDataType(attr.getValue("type"));
if (!stackRNG.isEmpty()) { if (!stackRNG.isEmpty()) {
ElementRNG e = stackRNG.getLast(); ElementRNG e = stackRNG.lastElement();
elementRNG.setParent(e); elementRNG.setParent(e);
e.getChildren().add(elementRNG); e.getChildren().add(elementRNG);
} }
...@@ -129,11 +128,11 @@ public class PastisSAX2Handler extends DefaultHandler { ...@@ -129,11 +128,11 @@ public class PastisSAX2Handler extends DefaultHandler {
public void characters(char[] caracteres, int start, int length) throws SAXException { public void characters(char[] caracteres, int start, int length) throws SAXException {
if (isInDocumentationTag) { if (isInDocumentationTag) {
documentationContent.append(new String(caracteres, start, length)); documentationContent.append(new String(caracteres, start, length));
stackRNG.getLast().setValue(documentationContent.toString()); stackRNG.lastElement().setValue(documentationContent.toString());
} }
if (isValue) { if (isValue) {
String valueContent = new String(caracteres, start, length); String valueContent = new String(caracteres, start, length);
stackRNG.getLast().setValue(valueContent); stackRNG.lastElement().setValue(valueContent);
this.isValue = false; this.isValue = false;
} }
} }
......
...@@ -54,15 +54,12 @@ import fr.gouv.vitamui.pastis.common.dto.jaxb.ValueXML; ...@@ -54,15 +54,12 @@ import fr.gouv.vitamui.pastis.common.dto.jaxb.ValueXML;
import fr.gouv.vitamui.pastis.common.dto.jaxb.ZeroOrMoreXML; import fr.gouv.vitamui.pastis.common.dto.jaxb.ZeroOrMoreXML;
import fr.gouv.vitamui.pastis.common.util.ManifestValidator; import fr.gouv.vitamui.pastis.common.util.ManifestValidator;
import fr.gouv.vitamui.pastis.common.util.PastisCustomCharacterEscapeHandler; import fr.gouv.vitamui.pastis.common.util.PastisCustomCharacterEscapeHandler;
import fr.gouv.vitamui.pastis.common.util.PropertiesUtils;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
......
package fr.gouv.vitamui.pastis.common.service;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import fr.gouv.vitamui.pastis.common.dto.ElementProperties;
import fr.gouv.vitamui.pastis.common.dto.ElementRNG;
import fr.gouv.vitamui.pastis.common.dto.jaxb.*;
import fr.gouv.vitamui.pastis.common.util.PastisCustomCharacterEscapeHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
public class PastisGetJsonTree {
private static final Logger LOGGER = LoggerFactory.getLogger(PastisGetJsonTree.class);
// Test an xml to json and a json to xml.
public String getJsonParsedTree(ElementRNG elementRNGRoot) throws JAXBException, FileNotFoundException {
//vWhen the handler is called, the proprities tree (json) is build
// using its ElementRNG(elementRngRoot) object.
// The elementRngRoot is filled when the xml file is read, by passing
// it to the contentHanler of the Xml reader.
// The methods used are the 5 main methods of a DefaultHandler type
// See methods bellow
ElementRNG.buildElementPropertiesTree(elementRNGRoot, 0, null);
ElementProperties eparent = ElementRNG.getElementStaticRoot();
// The eparentRng is an object of type BalizeXML. It is built using the
// object eparent (of type ElementProperties) that, in fact, represent the json
// prouced during the parser's first call.
BaliseXML.buildBaliseXMLTree(eparent, 0, null);
BaliseXML eparentRng = BaliseXML.getBaliseXMLStatic();
// Transforms java objects to Xml file (Marshalling)
JAXBContext contextObj =
JAXBContext.newInstance(AttributeXML.class, ElementXML.class, DataXML.class, ValueXML.class,
OptionalXML.class, OneOrMoreXML.class,
ZeroOrMoreXML.class, AnnotationXML.class, DocumentationXML.class, ChoiceXml.class);
Marshaller marshallerObj = contextObj.createMarshaller();
marshallerObj.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshallerObj.setProperty("com.sun.xml.bind.marshaller.CharacterEscapeHandler",
new PastisCustomCharacterEscapeHandler());
marshallerObj.marshal(eparentRng, new FileOutputStream("generated_test.xml"));
ObjectMapper mapper = new ObjectMapper();
String jsonString = "";
try {
jsonString = mapper.writeValueAsString(eparent);
} catch (JsonGenerationException e1) {
LOGGER.debug("JsonGenerationException", e1);
} catch (JsonMappingException e1) {
LOGGER.debug("JsonMappingException", e1);
} catch (IOException e1) {
LOGGER.debug("IOException", e1);
}
return "[" + jsonString + "]";
}
}
...@@ -38,11 +38,7 @@ knowledge of the CeCILL-C license and that you accept its terms. ...@@ -38,11 +38,7 @@ knowledge of the CeCILL-C license and that you accept its terms.
package fr.gouv.vitamui.pastis.common.service; package fr.gouv.vitamui.pastis.common.service;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fr.gouv.vitamui.pastis.common.dto.ElementProperties; import fr.gouv.vitamui.pastis.common.dto.ElementProperties;
import fr.gouv.vitamui.pastis.common.dto.ElementRNG;
import fr.gouv.vitamui.pastis.common.util.PastisGetXmlJsonTree;
import fr.gouv.vitamui.pastis.common.util.PastisMarshaller; import fr.gouv.vitamui.pastis.common.util.PastisMarshaller;
import fr.gouv.vitamui.pastis.common.util.PastisSAX2Handler; import fr.gouv.vitamui.pastis.common.util.PastisSAX2Handler;
import org.junit.Assert; import org.junit.Assert;
...@@ -65,8 +61,6 @@ import java.net.URISyntaxException; ...@@ -65,8 +61,6 @@ import java.net.URISyntaxException;
@TestPropertySource(locations = "/application-test.yml") @TestPropertySource(locations = "/application-test.yml")
public class PastisTest { public class PastisTest {
private static final Logger LOGGER = LoggerFactory.getLogger(ElementRNG.class);
public PastisMarshaller pastisMarshaller = new PastisMarshaller(); public PastisMarshaller pastisMarshaller = new PastisMarshaller();
@Value("${rng.base.file}") @Value("${rng.base.file}")
...@@ -96,7 +90,7 @@ public class PastisTest { ...@@ -96,7 +90,7 @@ public class PastisTest {
public void testIfJSONCanBeGenerated() throws IOException, JAXBException, URISyntaxException, SAXException { public void testIfJSONCanBeGenerated() throws IOException, JAXBException, URISyntaxException, SAXException {
PastisSAX2Handler handler = new PastisSAX2Handler(); PastisSAX2Handler handler = new PastisSAX2Handler();
PastisGetXmlJsonTree getJson = new PastisGetXmlJsonTree(); PastisGetJsonTree getJson = new PastisGetJsonTree();
XMLReader xmlReader = XMLReaderFactory.createXMLReader(); XMLReader xmlReader = XMLReaderFactory.createXMLReader();
xmlReader.setContentHandler(handler); xmlReader.setContentHandler(handler);
...@@ -104,7 +98,7 @@ public class PastisTest { ...@@ -104,7 +98,7 @@ public class PastisTest {
ClassLoader loader = ClassLoader.getSystemClassLoader(); ClassLoader loader = ClassLoader.getSystemClassLoader();
xmlReader.parse(loader.getResource(this.rngFileName).toURI().toString()); xmlReader.parse(loader.getResource(this.rngFileName).toURI().toString());
String jsonTree = getJson.getJsonParsedTreeTest(handler.getElementRNGRoot()); String jsonTree = getJson.getJsonParsedTree(handler.getElementRNGRoot());
Assert.assertNotNull("JSON profile generated successfully", jsonTree); Assert.assertNotNull("JSON profile generated successfully", jsonTree);
......
...@@ -35,7 +35,7 @@ same conditions as regards security. ...@@ -35,7 +35,7 @@ same conditions as regards security.
The fact that you are presently reading this means that you have had The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms. knowledge of the CeCILL-C license and that you accept its terms.
*/ */
package fr.gouv.vitamui.pastis.common.util; package fr.gouv.vitamui.pastis.common.service;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
...@@ -69,10 +69,11 @@ public final class PropertiesUtils { ...@@ -69,10 +69,11 @@ public final class PropertiesUtils {
throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile);
} }
if (url == null) { if (url == null) {
url = Thread.currentThread().getContextClassLoader().getResource(resourcesFile); try {
} url = Thread.currentThread().getContextClassLoader().getResource(resourcesFile);
if (url == null) { } catch (Exception e) {
throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile); throw new FileNotFoundException(FILE_NOT_FOUND_IN_RESOURCES + resourcesFile);
}
} }
File file; File file;
try { try {
......
...@@ -35,8 +35,9 @@ same conditions as regards security. ...@@ -35,8 +35,9 @@ same conditions as regards security.
The fact that you are presently reading this means that you have had The fact that you are presently reading this means that you have had
knowledge of the CeCILL-C license and that you accept its terms. knowledge of the CeCILL-C license and that you accept its terms.
*/ */
package fr.gouv.vitamui.pastis.common.util; package fr.gouv.vitamui.pastis.common.service;
import fr.gouv.vitamui.pastis.common.util.XMLInputFactoryUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
......
...@@ -41,8 +41,6 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -41,8 +41,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import fr.gouv.vitamui.pastis.common.dto.ElementProperties; import fr.gouv.vitamui.pastis.common.dto.ElementProperties;
import fr.gouv.vitamui.pastis.common.dto.jaxb.*; import fr.gouv.vitamui.pastis.common.dto.jaxb.*;
import fr.gouv.vitamui.pastis.common.util.PastisCustomCharacterEscapeHandler; import fr.gouv.vitamui.pastis.common.util.PastisCustomCharacterEscapeHandler;
import fr.gouv.vitamui.pastis.common.util.PropertiesUtils;
import fr.gouv.vitamui.pastis.common.util.RNGProfileValidator;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
......
...@@ -90,7 +90,7 @@ public class PastisConfiguration { ...@@ -90,7 +90,7 @@ public class PastisConfiguration {
@Bean @Bean
public PuaFromJSON puaFromJSON() { public PuaFromJSON puaFromJSON() {
return new PuaFromJSON(); return new PuaFromJSON(puaPastisValidator());
} }
@Bean @Bean
......
...@@ -317,110 +317,4 @@ ...@@ -317,110 +317,4 @@
</plugins> </plugins>
</build> </build>
<profiles>
<!-- Start of standalone profile -->
<profile>
<id>standalone</id>
<build>
<!-- Start of stadalone profile plugins -->
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>fr.gouv.vitamui</groupId>
<artifactId>pastis-client</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-api</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-rest</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui.commons</groupId>
<artifactId>commons-vitam</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui</groupId>
<artifactId>security-client</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>fr.gouv.vitamui</groupId>
<artifactId>iam-internal-client</artifactId>
<version>5.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>true</executable>
<attach>false</attach> <!-- Need to use the original jar for integration-tests -->
<mainClass>fr.gouv.vitamui.pastis.server.ApiPastisServerApplication</mainClass>
<arguments>
<argument>--spring.profiles.active=dev</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project> </project>
...@@ -129,7 +129,7 @@ public class ApiPastisServerConfig extends AbstractContextConfiguration { ...@@ -129,7 +129,7 @@ public class ApiPastisServerConfig extends AbstractContextConfiguration {
@Bean @Bean
public PuaFromJSON puaFromJSON() { public PuaFromJSON puaFromJSON() {
return new PuaFromJSON(); return new PuaFromJSON(puaPastisValidator());
} }
@Bean @Bean
......
...@@ -41,7 +41,6 @@ import fr.gouv.vitam.access.external.client.AccessExternalClient; ...@@ -41,7 +41,6 @@ import fr.gouv.vitam.access.external.client.AccessExternalClient;
import fr.gouv.vitam.access.external.client.AdminExternalClient; import fr.gouv.vitam.access.external.client.AdminExternalClient;
import fr.gouv.vitamui.commons.api.application.AbstractContextConfiguration; import fr.gouv.vitamui.commons.api.application.AbstractContextConfiguration;
import fr.gouv.vitamui.pastis.common.service.JsonFromPUA; import fr.gouv.vitamui.pastis.common.service.JsonFromPUA;
import fr.gouv.vitamui.pastis.common.service.PuaDefinitions;
import fr.gouv.vitamui.pastis.common.service.PuaFromJSON; import fr.gouv.vitamui.pastis.common.service.PuaFromJSON;
import fr.gouv.vitamui.pastis.common.service.PuaPastisValidator; import fr.gouv.vitamui.pastis.common.service.PuaPastisValidator;
import fr.gouv.vitamui.pastis.common.util.NoticeUtils; import fr.gouv.vitamui.pastis.common.util.NoticeUtils;
...@@ -75,9 +74,6 @@ public class ApiPastisServerConfigTest extends AbstractContextConfiguration { ...@@ -75,9 +74,6 @@ public class ApiPastisServerConfigTest extends AbstractContextConfiguration {
@MockBean @MockBean
private NoticeUtils noticeFromPUA; private NoticeUtils noticeFromPUA;
@MockBean
private PuaDefinitions puaDefinitions;
@MockBean @MockBean
private PuaFromJSON puaFromJSON; private PuaFromJSON puaFromJSON;
......
...@@ -25,12 +25,4 @@ server-identity: ...@@ -25,12 +25,4 @@ server-identity:
identityName: vitamui-test identityName: vitamui-test
identityRole: pastis-external identityRole: pastis-external
identityServerId: 1 identityServerId: 1
json.template.file: rng/AUP_default_PASTIS.json
rng.base.directory: rng/
rng.base.file: rng/Profil_seda_pastis_mvp.rng
json.base.file: rng/ProfileJson.json
pua.definitions.file: pua_validation/ProfileJson.json
logbook.scheduling.sendEventToVitamTasks.enabled: false logbook.scheduling.sendEventToVitamTasks.enabled: false
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment