Skip to content

Commit c4d0729

Browse files
authored
Merge pull request #283 from com-pas/feat/282-RSR-748_remove-dependency-to-compas-corescl2007b4
fix(#282): RSR-748 Remove dependency to compas-core.scl2007b4
2 parents f3df371 + 50aabec commit c4d0729

File tree

4 files changed

+19
-36
lines changed

4 files changed

+19
-36
lines changed

pom.xml

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,10 @@
4444
<logback-classic.version>1.4.5</logback-classic.version>
4545
<assertj.version>3.22.0</assertj.version>
4646
<lombok.version>1.18.24</lombok.version>
47+
<jackson-databind.version>2.13.4.1</jackson-databind.version>
4748
</properties>
4849

4950
<dependencies>
50-
<dependency>
51-
<groupId>org.lfenergy.compas.core</groupId>
52-
<artifactId>scl2007b4</artifactId>
53-
</dependency>
54-
<dependency>
55-
<groupId>org.lfenergy.compas.core</groupId>
56-
<artifactId>scl-extension</artifactId>
57-
</dependency>
5851
<dependency>
5952
<groupId>ch.qos.logback</groupId>
6053
<artifactId>logback-classic</artifactId>
@@ -85,11 +78,6 @@
8578
<version>${junit-version}</version>
8679
<scope>test</scope>
8780
</dependency>
88-
<dependency>
89-
<groupId>org.lfenergy.compas.core</groupId>
90-
<artifactId>scl2007b4</artifactId>
91-
<version>${compas-core.version}</version>
92-
</dependency>
9381
<dependency>
9482
<groupId>org.lfenergy.compas.core</groupId>
9583
<artifactId>scl-extension</artifactId>
@@ -110,6 +98,11 @@
11098
<artifactId>assertj-core</artifactId>
11199
<version>${assertj.version}</version>
112100
</dependency>
101+
<dependency>
102+
<groupId>com.fasterxml.jackson.core</groupId>
103+
<artifactId>jackson-databind</artifactId>
104+
<version>${jackson-databind.version}</version>
105+
</dependency>
113106
</dependencies>
114107
</dependencyManagement>
115108
<modules>
@@ -122,16 +115,6 @@
122115
<build>
123116
<pluginManagement>
124117
<plugins>
125-
<plugin>
126-
<groupId>org.lfenergy.compas.xsd</groupId>
127-
<artifactId>compas-scl-xsd</artifactId>
128-
<version>${compas-scl-xsd.version}</version>
129-
</plugin>
130-
<plugin>
131-
<groupId>org.lfenergy.compas.core</groupId>
132-
<artifactId>scl-extension</artifactId>
133-
<version>${compas-core.version}</version>
134-
</plugin>
135118
<plugin>
136119
<groupId>org.apache.maven.plugins</groupId>
137120
<artifactId>maven-compiler-plugin</artifactId>

sct-commons/pom.xml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
<artifactId>commons-lang3</artifactId>
3636
<version>3.12.0</version>
3737
</dependency>
38+
<dependency>
39+
<groupId>com.fasterxml.jackson.core</groupId>
40+
<artifactId>jackson-databind</artifactId>
41+
</dependency>
3842
<dependency>
3943
<groupId>jakarta.xml.bind</groupId>
4044
<artifactId>jakarta.xml.bind-api</artifactId>
@@ -170,7 +174,7 @@
170174
<artifactId>scl-extension</artifactId>
171175
</artifactItem>
172176
</artifactItems>
173-
<outputDirectory>${project.build.directory}</outputDirectory>
177+
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
174178
</configuration>
175179
</execution>
176180
</executions>
@@ -189,8 +193,8 @@
189193
</executions>
190194
<configuration>
191195
<sources>
192-
<source>${project.build.directory}/xsd/SCL2007B4/SCL.xsd</source>
193-
<source>${project.build.directory}/xsd/SCL_CoMPAS.xsd</source>
196+
<source>${project.build.outputDirectory}/xsd/SCL2007B4/SCL.xsd</source>
197+
<source>${project.build.outputDirectory}/xsd/SCL_CoMPAS.xsd</source>
194198
</sources>
195199
<xjbSources>
196200
<xjbSource>${project.basedir}/src/main/resources/binding_configuration.xjb</xjbSource>

sct-commons/src/main/java/org/lfenergy/compas/sct/commons/util/PrivateEnum.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import lombok.Getter;
88
import org.lfenergy.compas.scl2007b4.model.*;
99

10-
import javax.validation.constraints.NotNull;
1110
import java.util.Arrays;
1211
import java.util.Map;
1312
import java.util.NoSuchElementException;
@@ -43,7 +42,6 @@ <T> PrivateEnum(String privateType, Class<T> compasClass) {
4342
this.compasClass = compasClass;
4443
}
4544

46-
@NotNull
4745
public static PrivateEnum fromClass(Class<?> compasClass) {
4846
PrivateEnum result = classToEnum.get(compasClass);
4947
if (result == null) {

sct-commons/src/test/java/org/lfenergy/compas/sct/commons/testhelpers/MarshallerWrapper.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
import lombok.extern.slf4j.Slf4j;
99
import org.apache.commons.io.IOUtils;
1010
import org.assertj.core.api.Assertions;
11-
import org.lfenergy.compas.core.commons.exception.CompasErrorCode;
12-
import org.lfenergy.compas.core.commons.exception.CompasException;
1311
import org.lfenergy.compas.scl2007b4.model.SCL;
12+
import org.opentest4j.AssertionFailedError;
1413
import org.xml.sax.InputSource;
1514
import org.xml.sax.SAXException;
1615
import org.xml.sax.XMLReader;
@@ -54,7 +53,7 @@ public static String marshall(final Object obj) {
5453
} catch (JAXBException exp) {
5554
String message = String.format("Error marshalling the Class: %s", exp);
5655
log.error(message, exp);
57-
throw new CompasException(CompasErrorCode.MARSHAL_ERROR_CODE, message);
56+
throw new AssertionFailedError(message, exp);
5857
}
5958
}
6059

@@ -67,14 +66,13 @@ public static <T> T unmarshall(final InputStream xml, Class<T> cls) {
6766
try {
6867
Object result = getInstance().unmarshaller.unmarshal(new StreamSource(xml));
6968
if (!result.getClass().isAssignableFrom(cls)) {
70-
throw new CompasException(CompasErrorCode.UNMARSHAL_ERROR_CODE,
71-
"Error unmarshalling to the Class. Invalid class");
69+
throw new AssertionFailedError("Error unmarshalling to the Class. Invalid class");
7270
}
7371
return cls.cast(result);
7472
} catch (JAXBException exp) {
7573
String message = String.format("Error unmarshalling to the Class: %s", exp.getLocalizedMessage());
7674
log.error(message, exp);
77-
throw new CompasException(CompasErrorCode.UNMARSHAL_ERROR_CODE, message, exp);
75+
throw new AssertionFailedError(message, exp);
7876
}
7977
}
8078

@@ -85,7 +83,7 @@ private static MarshallerWrapper getInstance() {
8583
} catch (JAXBException | SAXException | ParserConfigurationException exp) {
8684
var message = "Error creating JAXB Marshaller and Unmarshaller.";
8785
log.error(message, exp);
88-
throw new CompasException(CompasErrorCode.CREATION_ERROR_CODE, message, exp);
86+
throw new AssertionFailedError(message, exp);
8987
}
9088
}
9189
return singleton;
@@ -122,7 +120,7 @@ private static Source toSchemaSource(String path, XMLReader xmlReader) {
122120
} catch (IOException e) {
123121
var message = "Error loading XML schema : " + path;
124122
log.error(message, e);
125-
throw new CompasException(CompasErrorCode.CREATION_ERROR_CODE, message);
123+
throw new AssertionFailedError(message, e);
126124
}
127125
InputSource inputSource = new InputSource(url.toString());
128126
return new SAXSource(xmlReader, inputSource);

0 commit comments

Comments
 (0)